Skip to content

Commit

Permalink
Merge pull request #10817 from jeremyharris/fix-10814
Browse files Browse the repository at this point in the history
Fixed FixtureInjector method compatibility
  • Loading branch information
markstory committed Jun 24, 2017
2 parents 4168bd3 + 33387ef commit 74530d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 86 deletions.
87 changes: 2 additions & 85 deletions src/TestSuite/Fixture/FixtureInjector.php
Expand Up @@ -19,29 +19,18 @@
trigger_error(sprintf('Your PHPUnit Version must be at least 5.7.0 to use CakePHP Testsuite, found %s', \PHPUnit_Runner_Version::id()), E_USER_ERROR);
}
class_alias('PHPUnit_Framework_Test', 'PHPUnit\Framework\Test');
class_alias('PHPUnit_Framework_Warning', 'PHPUnit\Framework\Warning');

if (!class_exists('PHPUnit\Framework\TestSuite')) {
class_alias('PHPUnit_Framework_TestSuite', 'PHPUnit\Framework\TestSuite');
}
if (!class_exists('PHPUnit\Framework\AssertionFailedError')) {
class_alias('PHPUnit_Framework_AssertionFailedError', 'PHPUnit\Framework\AssertionFailedError');
}
}

use Cake\TestSuite\TestCase;
use Exception;
use PHPUnit\Framework\AssertionFailedError;
use PHPUnit\Framework\BaseTestListener;
use PHPUnit\Framework\Test;
use PHPUnit\Framework\TestListener;
use PHPUnit\Framework\TestSuite;
use PHPUnit\Framework\Warning;

/**
* Test listener used to inject a fixture manager in all tests that
* are composed inside a Test Suite
*/
class FixtureInjector implements TestListener
class FixtureInjector extends BaseTestListener
{

/**
Expand Down Expand Up @@ -100,66 +89,6 @@ public function endTestSuite(TestSuite $suite)
}
}

/**
* Not Implemented
*
* @param \PHPUnit\Framework\Test $test The test to add errors from.
* @param \Exception $e The exception
* @param float $time current time
* @return void
*/
public function addError(Test $test, Exception $e, $time)
{
}

/**
* Not Implemented
*
* @param \PHPUnit\Framework\Test $test The test to add warnings from.
* @param \PHPUnit\Framework\Warning $e The warning
* @param float $time current time
* @return void
*/
public function addWarning(Test $test, Warning $e, $time)
{
}

/**
* Not Implemented
*
* @param \PHPUnit\Framework\Test $test The test case
* @param \PHPUnit\Framework\AssertionFailedError $e The failed assertion
* @param float $time current time
* @return void
*/
public function addFailure(Test $test, AssertionFailedError $e, $time)
{
}

/**
* Not Implemented
*
* @param \PHPUnit\Framework\Test $test The test case
* @param \Exception $e The incomplete test error.
* @param float $time current time
* @return void
*/
public function addIncompleteTest(Test $test, Exception $e, $time)
{
}

/**
* Not Implemented
*
* @param \PHPUnit\Framework\Test $test The test case
* @param \Exception $e Skipped test exception
* @param float $time current time
* @return void
*/
public function addSkippedTest(Test $test, Exception $e, $time)
{
}

/**
* Adds fixtures to a test case when it starts.
*
Expand Down Expand Up @@ -188,16 +117,4 @@ public function endTest(Test $test, $time)
$this->_fixtureManager->unload($test);
}
}

/**
* Not Implemented
*
* @param \PHPUnit\Framework\Test $test The test case
* @param \Exception $e The exception to track
* @param float $time current time
* @return void
*/
public function addRiskyTest(Test $test, Exception $e, $time)
{
}
}
3 changes: 2 additions & 1 deletion src/TestSuite/TestSuite.php
Expand Up @@ -16,11 +16,12 @@
*/
namespace Cake\TestSuite;

if (class_exists('PHPUnit_Runner_Version') && !class_exists('PHPUnit\Framework\TestSuite')) {
if (class_exists('PHPUnit_Runner_Version')) {
if (version_compare(\PHPUnit_Runner_Version::id(), '5.7', '<')) {
trigger_error(sprintf('Your PHPUnit Version must be at least 5.7.0 to use CakePHP Testsuite, found %s', \PHPUnit_Runner_Version::id()), E_USER_ERROR);
}
class_alias('PHPUnit_Framework_TestSuite', 'PHPUnit\Framework\TestSuite');
class_alias('PHPUnit_Framework_AssertionFailedError', 'PHPUnit\Framework\AssertionFailedError');
}

use Cake\Filesystem\Folder;
Expand Down

0 comments on commit 74530d6

Please sign in to comment.