Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 412645f

Browse files
committed
update to modern class names
1 parent cc03f31 commit 412645f

20 files changed

+235
-270
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"autoload":{
1919
"psr-4":{
20-
"Codeception\\PHPUnit": "src\\"
20+
"Codeception\\PHPUnit\\": "src\\"
2121
}
2222
}
2323
}

src/ConsolePrinter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ interface ConsolePrinter
1111
{
1212
public function write($buffer);
1313

14-
public function printResult(\PHPUnit_Framework_TestResult $result);
14+
public function printResult(\PHPUnit\Framework\TestResult $result);
1515
}

src/Constraint/Crawler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
4545
}
4646
$output .= "\ncontains text '{$this->string}'";
4747

48-
throw new \PHPUnit_Framework_ExpectationFailedException(
48+
throw new \PHPUnit\Framework\ExpectationFailedException(
4949
$output,
5050
$comparisonFailure
5151
);

src/Constraint/CrawlerNot.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ protected function matches($nodes)
1313
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null)
1414
{
1515
if (!$this->string) {
16-
throw new \PHPUnit_Framework_ExpectationFailedException(
16+
throw new \PHPUnit\Framework\ExpectationFailedException(
1717
"Element '$selector' was found",
1818
$comparisonFailure
1919
);
@@ -25,7 +25,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
2525
$output .= $this->nodesList($nodes, $this->string);
2626
$output .= "\ncontaining '{$this->string}'";
2727

28-
throw new \PHPUnit_Framework_ExpectationFailedException(
28+
throw new \PHPUnit\Framework\ExpectationFailedException(
2929
$output,
3030
$comparisonFailure
3131
);

src/Constraint/JsonContains.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use SebastianBergmann\Comparator\Factory;
88
use Codeception\Util\JsonArray;
99

10-
class JsonContains extends \PHPUnit_Framework_Constraint
10+
class JsonContains extends \PHPUnit\Framework\Constraint
1111
{
1212
/**
1313
* @var
@@ -32,7 +32,7 @@ protected function matches($other)
3232
{
3333
$jsonResponseArray = new JsonArray($other);
3434
if (!is_array($jsonResponseArray->toArray())) {
35-
throw new \PHPUnit_Framework_AssertionFailedError('JSON response is not an array: ' . $other);
35+
throw new \PHPUnit\Framework\AssertionFailedError('JSON response is not an array: ' . $other);
3636
}
3737

3838
if ($jsonResponseArray->containsArray($this->expected)) {
@@ -44,7 +44,7 @@ protected function matches($other)
4444
try {
4545
$comparator->assertEquals($this->expected, $jsonResponseArray->toArray());
4646
} catch (ComparisonFailure $failure) {
47-
throw new \PHPUnit_Framework_ExpectationFailedException(
47+
throw new \PHPUnit\Framework\ExpectationFailedException(
4848
"Response JSON does not contain the provided JSON\n",
4949
$failure
5050
);

src/Constraint/JsonType.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Codeception\Util\JsonType as JsonTypeUtil;
66
use Codeception\Util\JsonArray;
77

8-
class JsonType extends \PHPUnit_Framework_Constraint
8+
class JsonType extends \PHPUnit\Framework\Constraint
99
{
1010
protected $jsonType;
1111
private $match;
@@ -35,11 +35,11 @@ protected function matches($jsonArray)
3535

3636
if ($this->match) {
3737
if ($matched !== true) {
38-
throw new \PHPUnit_Framework_ExpectationFailedException($matched);
38+
throw new \PHPUnit\Framework\ExpectationFailedException($matched);
3939
}
4040
} else {
4141
if ($matched === true) {
42-
throw new \PHPUnit_Framework_ExpectationFailedException('Unexpectedly response matched: ' . json_encode($jsonArray));
42+
throw new \PHPUnit\Framework\ExpectationFailedException('Unexpectedly response matched: ' . json\encode($jsonArray));
4343
}
4444
}
4545
return true;

src/Constraint/Page.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
use Codeception\Lib\Console\Message;
55

6-
class Page extends \PHPUnit_Framework_Constraint
6+
class Page extends \PHPUnit\Framework\Constraint
77
{
88
protected $uri;
99

src/Constraint/WebDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
4848
}
4949
$output .= "\ncontains text '" . $this->string . "'";
5050

51-
throw new \PHPUnit_Framework_ExpectationFailedException(
51+
throw new \PHPUnit\Framework\ExpectationFailedException(
5252
$output,
5353
$comparisonFailure
5454
);

src/Constraint/WebDriverNot.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
1515
{
1616
$selectorString = Locator::humanReadableString($selector);
1717
if (!$this->string) {
18-
throw new \PHPUnit_Framework_ExpectationFailedException(
18+
throw new \PHPUnit\Framework\ExpectationFailedException(
1919
"Element $selectorString was found",
2020
$comparisonFailure
2121
);
@@ -26,7 +26,7 @@ protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure
2626
$output .= $this->nodesList($nodes, $this->string);
2727
$output .= "\ncontaining '{$this->string}'";
2828

29-
throw new \PHPUnit_Framework_ExpectationFailedException(
29+
throw new \PHPUnit\Framework\ExpectationFailedException(
3030
$output,
3131
$comparisonFailure
3232
);

src/FilterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
* Class FilterTest
1010
* @package Codeception\PHPUnit
1111
*/
12-
class FilterTest extends \PHPUnit_Runner_Filter_Test
12+
class FilterTest extends \PHPUnit\Runner\Filter\NameFilterIterator
1313
{
1414
public function accept()
1515
{
1616
$test = $this->getInnerIterator()->current();
1717

18-
if ($test instanceof \PHPUnit_Framework_TestSuite) {
18+
if ($test instanceof \PHPUnit\Framework\TestSuite) {
1919
return true;
2020
}
2121

src/Listener.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
use Codeception\Events;
88
use Codeception\TestInterface;
99
use Exception;
10-
use PHPUnit_Framework_Test;
10+
use PHPUnit\Framework\Test;
1111
use Symfony\Component\EventDispatcher\EventDispatcher;
1212

13-
class Listener implements \PHPUnit_Framework_TestListener
13+
class Listener implements \PHPUnit\Framework\TestListener
1414
{
1515
/**
1616
* @var \Symfony\Component\EventDispatcher\EventDispatcher
@@ -29,33 +29,33 @@ public function __construct(EventDispatcher $dispatcher)
2929
/**
3030
* Risky test.
3131
*
32-
* @param PHPUnit_Framework_Test $test
32+
* @param PHPUnit\Framework\Test $test
3333
* @param Exception $e
3434
* @param float $time
3535
* @since Method available since Release 4.0.0
3636
*/
37-
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time)
37+
public function addRiskyTest(\PHPUnit\Framework\Test $test, Exception $e, $time)
3838
{
3939
}
4040

41-
public function addFailure(\PHPUnit_Framework_Test $test, \PHPUnit_Framework_AssertionFailedError $e, $time)
41+
public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, $time)
4242
{
4343
$this->unsuccessfulTests[] = spl_object_hash($test);
4444
$this->fire(Events::TEST_FAIL, new FailEvent($test, $time, $e));
4545
}
4646

47-
public function addError(\PHPUnit_Framework_Test $test, \Exception $e, $time)
47+
public function addError(\PHPUnit\Framework\Test $test, \Exception $e, $time)
4848
{
4949
$this->unsuccessfulTests[] = spl_object_hash($test);
5050
$this->fire(Events::TEST_ERROR, new FailEvent($test, $time, $e));
5151
}
5252

5353
// This method was added in PHPUnit 6
54-
public function addWarning(\PhpUnit_Framework_Test $test, \PHPUnit_Framework_Warning $e, $time)
54+
public function addWarning(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\Warning $e, $time)
5555
{
5656
}
5757

58-
public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e, $time)
58+
public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
5959
{
6060
if (in_array(spl_object_hash($test), $this->skippedTests)) {
6161
return;
@@ -65,7 +65,7 @@ public function addIncompleteTest(\PHPUnit_Framework_Test $test, \Exception $e,
6565
$this->skippedTests[] = spl_object_hash($test);
6666
}
6767

68-
public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $time)
68+
public function addSkippedTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
6969
{
7070
if (in_array(spl_object_hash($test), $this->skippedTests)) {
7171
return;
@@ -75,17 +75,17 @@ public function addSkippedTest(\PHPUnit_Framework_Test $test, \Exception $e, $ti
7575
$this->skippedTests[] = spl_object_hash($test);
7676
}
7777

78-
public function startTestSuite(\PHPUnit_Framework_TestSuite $suite)
78+
public function startTestSuite(\PHPUnit\Framework\TestSuite $suite)
7979
{
8080
$this->dispatcher->dispatch('suite.start', new SuiteEvent($suite));
8181
}
8282

83-
public function endTestSuite(\PHPUnit_Framework_TestSuite $suite)
83+
public function endTestSuite(\PHPUnit\Framework\TestSuite $suite)
8484
{
8585
$this->dispatcher->dispatch('suite.end', new SuiteEvent($suite));
8686
}
8787

88-
public function startTest(\PHPUnit_Framework_Test $test)
88+
public function startTest(\PHPUnit\Framework\Test $test)
8989
{
9090
$this->dispatcher->dispatch(Events::TEST_START, new TestEvent($test));
9191
if (!$test instanceof TestInterface) {
@@ -98,16 +98,16 @@ public function startTest(\PHPUnit_Framework_Test $test)
9898
try {
9999
$this->startedTests[] = spl_object_hash($test);
100100
$this->fire(Events::TEST_BEFORE, new TestEvent($test));
101-
} catch (\PHPUnit_Framework_IncompleteTestError $e) {
101+
} catch (\PHPUnit\Framework\IncompleteTestError $e) {
102102
$test->getTestResultObject()->addFailure($test, $e, 0);
103-
} catch (\PHPUnit_Framework_SkippedTestError $e) {
103+
} catch (\PHPUnit\Framework\SkippedTestError $e) {
104104
$test->getTestResultObject()->addFailure($test, $e, 0);
105105
} catch (\Exception $e) {
106106
$test->getTestResultObject()->addError($test, $e, 0);
107107
}
108108
}
109109

110-
public function endTest(\PHPUnit_Framework_Test $test, $time)
110+
public function endTest(\PHPUnit\Framework\Test $test, $time)
111111
{
112112
$hash = spl_object_hash($test);
113113
if (!in_array($hash, $this->unsuccessfulTests)) {

src/Log/JUnit.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
use Codeception\Test\Interfaces\Reported;
66
use Codeception\Test\Test;
77

8-
class JUnit extends \PHPUnit_Util_Log_JUnit
8+
class JUnit extends \PHPUnit\Util\Log\JUnit
99
{
1010
protected $strictAttributes = ['file', 'name', 'class'];
1111

12-
public function startTest(\PHPUnit_Framework_Test $test)
12+
public function startTest(\PHPUnit\Framework\Test $test)
1313
{
1414
if (!$test instanceof Reported) {
1515
return parent::startTest($test);
@@ -27,7 +27,7 @@ public function startTest(\PHPUnit_Framework_Test $test)
2727
}
2828
}
2929

30-
public function endTest(\PHPUnit_Framework_Test $test, $time)
30+
public function endTest(\PHPUnit\Framework\Test $test, $time)
3131
{
3232
if ($this->currentTestCase !== null and $test instanceof Test) {
3333
$numAssertions = $test->getNumAssertions();

src/Overrides/Filter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
2-
2+
namespace PHPUnit\Util;
33
// @codingStandardsIgnoreStart
4-
class PHPUnit_Util_Filter
4+
class Filter
55
{
66
// @codingStandardsIgnoreEnd
77
protected static $filteredClassesPattern = [
@@ -15,7 +15,7 @@ public static function getFilteredStackTrace($e, $asString = true, $filter = tru
1515
$stackTrace = $asString ? '' : [];
1616

1717
$trace = $e->getPrevious() ? $e->getPrevious()->getTrace() : $e->getTrace();
18-
if ($e instanceof \PHPUnit_Framework_ExceptionWrapper) {
18+
if ($e instanceof \PHPUnit\Framework\ExceptionWrapper) {
1919
$trace = $e->getSerializableTrace();
2020
}
2121

src/ResultPrinter.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,83 @@
11
<?php
22
namespace Codeception\PHPUnit;
33

4-
use PHPUnit_Framework_AssertionFailedError;
5-
use PHPUnit_Framework_Test;
6-
use PHPUnit_Runner_BaseTestRunner;
4+
use \PHPUnit\Framework\AssertionFailedError;
5+
use \PHPUnit\Framework\Test;
6+
use \PHPUnit\Runner\BaseTestRunner;
77

8-
class ResultPrinter extends \PHPUnit_Util_TestDox_ResultPrinter
8+
class ResultPrinter extends \PHPUnit\Util\TestDox\ResultPrinter
99
{
1010
/**
1111
* An error occurred.
1212
*
13-
* @param PHPUnit_Framework_Test $test
13+
* @param \PHPUnit\Framework\Test $test
1414
* @param \Exception $e
1515
* @param float $time
1616
*/
17-
public function addError(PHPUnit_Framework_Test $test, \Exception $e, $time)
17+
public function addError(\PHPUnit\Framework\Test $test, \Exception $e, $time)
1818
{
19-
$this->testStatus = PHPUnit_Runner_BaseTestRunner::STATUS_ERROR;
19+
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_ERROR;
2020
$this->failed++;
2121
}
2222

2323
/**
2424
* A failure occurred.
2525
*
26-
* @param PHPUnit_Framework_Test $test
27-
* @param PHPUnit_Framework_AssertionFailedError $e
26+
* @param \PHPUnit\Framework\Test $test
27+
* @param \PHPUnit\Framework\AssertionFailedError $e
2828
* @param float $time
2929
*/
30-
public function addFailure(PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time)
30+
public function addFailure(\PHPUnit\Framework\Test $test, \PHPUnit\Framework\AssertionFailedError $e, $time)
3131
{
32-
$this->testStatus = PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE;
32+
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_FAILURE;
3333
$this->failed++;
3434
}
3535

3636
/**
3737
* Incomplete test.
3838
*
39-
* @param PHPUnit_Framework_Test $test
39+
* @param \PHPUnit\Framework\Test $test
4040
* @param \Exception $e
4141
* @param float $time
4242
*/
43-
public function addIncompleteTest(PHPUnit_Framework_Test $test, \Exception $e, $time)
43+
public function addIncompleteTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
4444
{
45-
$this->testStatus = PHPUnit_Runner_BaseTestRunner::STATUS_INCOMPLETE;
45+
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_INCOMPLETE;
4646
$this->incomplete++;
4747
}
4848

4949
/**
5050
* Risky test.
5151
*
52-
* @param PHPUnit_Framework_Test $test
52+
* @param \PHPUnit\Framework\Test $test
5353
* @param \Exception $e
5454
* @param float $time
5555
*
5656
* @since Method available since Release 4.0.0
5757
*/
58-
public function addRiskyTest(PHPUnit_Framework_Test $test, \Exception $e, $time)
58+
public function addRiskyTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
5959
{
60-
$this->testStatus = PHPUnit_Runner_BaseTestRunner::STATUS_RISKY;
60+
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_RISKY;
6161
$this->risky++;
6262
}
6363

6464
/**
6565
* Skipped test.
6666
*
67-
* @param PHPUnit_Framework_Test $test
67+
* @param \PHPUnit\Framework\Test $test
6868
* @param \Exception $e
6969
* @param float $time
7070
*
7171
* @since Method available since Release 3.0.0
7272
*/
73-
public function addSkippedTest(PHPUnit_Framework_Test $test, \Exception $e, $time)
73+
public function addSkippedTest(\PHPUnit\Framework\Test $test, \Exception $e, $time)
7474
{
75-
$this->testStatus = PHPUnit_Runner_BaseTestRunner::STATUS_SKIPPED;
75+
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_SKIPPED;
7676
$this->skipped++;
7777
}
7878

79-
public function startTest(PHPUnit_Framework_Test $test)
79+
public function startTest(\PHPUnit\Framework\Test $test)
8080
{
81-
$this->testStatus = PHPUnit_Runner_BaseTestRunner::STATUS_PASSED;
81+
$this->testStatus = \PHPUnit\Runner\BaseTestRunner::STATUS_PASSED;
8282
}
8383
}

0 commit comments

Comments
 (0)