Commit f0fb0093 authored by Klimov Paul's avatar Klimov Paul

Compatibility with PHPUnit 6.x

parent 629087c3
......@@ -17,7 +17,7 @@ cache:
install:
- travis_retry composer self-update && composer --version
- travis_retry composer global require "fxp/composer-asset-plugin:~1.1.1"
- travis_retry composer global require "fxp/composer-asset-plugin:^1.2.0"
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- travis_retry composer install --prefer-dist --no-interaction
......
......@@ -36,7 +36,8 @@ class ActiveFieldTest extends TestCase
$this->helperModel = new DynamicModel(['attributeName']);
ob_start();
$this->helperForm = new ActiveForm(['action' => '/something']);
$this->helperForm = ActiveForm::begin(['action' => '/something', 'enableClientScript' => false]);
ActiveForm::end();
ob_end_clean();
$this->activeField = new ActiveField(['form' => $this->helperForm]);
......
......@@ -2,6 +2,7 @@
namespace yiiunit\extensions\bootstrap;
use yii\bootstrap\Collapse;
use yii\widgets\ActiveForm;
/**
* @group bootstrap
......@@ -116,7 +117,8 @@ HTML
{
$template = ['template' => '{input}'];
ob_start();
$form = \yii\widgets\ActiveForm::begin(['action' => '/something']);
$form = ActiveForm::begin(['action' => '/something']);
ActiveForm::end();
ob_end_clean();
$model = new data\Singer;
......
......@@ -9,7 +9,7 @@ use Yii;
/**
* This is the base class for all yii framework unit tests.
*/
abstract class TestCase extends \PHPUnit_Framework_TestCase
abstract class TestCase extends \PHPUnit\Framework\TestCase
{
protected function setUp()
{
......
......@@ -13,3 +13,5 @@ require_once(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
Yii::setAlias('@yiiunit/extensions/bootstrap', __DIR__);
Yii::setAlias('@yii/bootstrap', dirname(__DIR__));
require_once(__DIR__ . '/compatibility.php');
\ No newline at end of file
<?php
/*
* Ensures compatibility with PHPUnit < 6.x
*/
namespace PHPUnit\Framework\Constraint {
if (!class_exists('PHPUnit\Framework\Constraint\Constraint') && class_exists('PHPUnit_Framework_Constraint')) {
abstract class Constraint extends \PHPUnit_Framework_Constraint {}
}
}
namespace PHPUnit\Framework {
if (!class_exists('PHPUnit\Framework\TestCase') && class_exists('PHPUnit_Framework_TestCase')) {
abstract class TestCase extends \PHPUnit_Framework_TestCase {
/**
* @param string $exception
*/
public function expectException($exception)
{
$this->setExpectedException($exception);
}
/**
* @param string $message
*/
public function expectExceptionMessage($message)
{
$this->setExpectedException($this->getExpectedException(), $message);
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment