diff --git a/composer.json b/composer.json index e4351b77..cad54724 100644 --- a/composer.json +++ b/composer.json @@ -33,9 +33,9 @@ "behat/behat": "^3.14", "friendsofphp/php-cs-fixer": "^3.68", "guzzlehttp/psr7": "^2", - "php-mock/php-mock-phpunit": "^2.6", + "php-mock/php-mock-phpunit": "^2.13", "phpstan/phpstan": "^2.1", - "phpunit/phpunit": "^9.5 || ^10.5" + "phpunit/phpunit": "^9.5 || ^10.5 || ^11.2 || ^12.0.9" }, "autoload": { "psr-4": { diff --git a/tests/Behat/Bootstrap/FeatureContext.php b/tests/Behat/Bootstrap/FeatureContext.php index b6e25fd9..d617dd1b 100644 --- a/tests/Behat/Bootstrap/FeatureContext.php +++ b/tests/Behat/Bootstrap/FeatureContext.php @@ -20,7 +20,7 @@ use RuntimeException; use SimpleXMLElement; -final class FeatureContext extends TestCase implements Context +final class FeatureContext implements Context { use AttachmentContextTrait; use CustomFieldContextTrait; @@ -90,8 +90,6 @@ public function __construct(string $redmineVersion, string $rootPath) } $this->redmine = static::$tracer::getRedmineInstance($version, $rootPath); - - parent::__construct('BehatRedmine' . $version->asId()); } /** @@ -126,7 +124,7 @@ private function registerClientResponse(mixed $lastReturn, Response $lastRespons */ public function theResponseHasTheStatusCode(int $statusCode) { - $this->assertSame( + TestCase::assertSame( $statusCode, $this->lastResponse->getStatusCode(), 'Raw response content: ' . $this->lastResponse->getContent(), @@ -138,7 +136,7 @@ public function theResponseHasTheStatusCode(int $statusCode) */ public function theResponseHasTheContentType(string $contentType) { - $this->assertStringStartsWith( + TestCase::assertStringStartsWith( $contentType, $this->lastResponse->getContentType(), 'Raw response content: ' . $this->lastResponse->getContent(), @@ -150,7 +148,7 @@ public function theResponseHasTheContentType(string $contentType) */ public function theResponseHasAnEmptyContentType() { - $this->assertSame('', $this->lastResponse->getContentType()); + TestCase::assertSame('', $this->lastResponse->getContentType()); } /** @@ -158,7 +156,7 @@ public function theResponseHasAnEmptyContentType() */ public function theResponseHasTheContent(string $content) { - $this->assertSame($content, $this->lastResponse->getContent()); + TestCase::assertSame($content, $this->lastResponse->getContent()); } /** @@ -166,7 +164,7 @@ public function theResponseHasTheContent(string $content) */ public function theResponseHasTheContentWithMultipleLines(PyStringNode $string) { - $this->assertSame($string->getRaw(), $this->lastResponse->getContent()); + TestCase::assertSame($string->getRaw(), $this->lastResponse->getContent()); } /** @@ -174,7 +172,7 @@ public function theResponseHasTheContentWithMultipleLines(PyStringNode $string) */ public function theReturnedDataIsTrue() { - $this->assertTrue($this->lastReturn); + TestCase::assertTrue($this->lastReturn); } /** @@ -182,7 +180,7 @@ public function theReturnedDataIsTrue() */ public function theReturnedDataIsFalse() { - $this->assertFalse($this->lastReturn); + TestCase::assertFalse($this->lastReturn); } /** @@ -190,7 +188,7 @@ public function theReturnedDataIsFalse() */ public function theReturnedDataIsExactly(string $content) { - $this->assertSame($content, $this->lastReturn); + TestCase::assertSame($content, $this->lastReturn); } /** @@ -198,7 +196,7 @@ public function theReturnedDataIsExactly(string $content) */ public function theReturnedDataIsExactlyWithMultipleLines(PyStringNode $string) { - $this->assertSame($string->getRaw(), $this->lastReturn); + TestCase::assertSame($string->getRaw(), $this->lastReturn); } /** @@ -206,7 +204,7 @@ public function theReturnedDataIsExactlyWithMultipleLines(PyStringNode $string) */ public function theReturnedDataIsAnInstanceOf(string $className) { - $this->assertInstanceOf($className, $this->lastReturn); + TestCase::assertInstanceOf($className, $this->lastReturn); } /** @@ -214,7 +212,7 @@ public function theReturnedDataIsAnInstanceOf(string $className) */ public function theReturnedDataIsAnArray() { - $this->assertIsArray($this->lastReturn); + TestCase::assertIsArray($this->lastReturn); } /** @@ -222,7 +220,7 @@ public function theReturnedDataIsAnArray() */ public function theReturnedDataContainsItems(int $count) { - $this->assertCount($count, $this->lastReturn); + TestCase::assertCount($count, $this->lastReturn); } /** @@ -264,7 +262,7 @@ public function theReturnedDataPropertyIsAnArray($property) $value = $this->getItemFromArray($returnData, $property); - $this->assertIsArray($value); + TestCase::assertIsArray($value); } /** @@ -276,8 +274,8 @@ public function theReturnedDataPropertyContainsItems($property, int $count) $value = $this->getItemFromArray($returnData, $property); - $this->assertIsArray($value); - $this->assertCount($count, $value); + TestCase::assertIsArray($value); + TestCase::assertCount($count, $value); } /** @@ -321,7 +319,7 @@ public function theReturnedDataPropertyHasOnlyTheFollowingProperties($property, $properties = array_keys($value); - $this->assertSame($string->getStrings(), $properties); + TestCase::assertSame($string->getStrings(), $properties); } /** @@ -393,7 +391,7 @@ private function getItemFromArray(array $array, $key): mixed private function assertTableNodeIsSameAsArray(TableNode $table, array $data) { foreach ($table as $row) { - $this->assertArrayHasKey($row['property'], $data, 'Possible keys are: ' . implode(', ', array_keys($data))); + TestCase::assertArrayHasKey($row['property'], $data, 'Possible keys are: ' . implode(', ', array_keys($data))); $value = $data[$row['property']]; @@ -438,7 +436,7 @@ private function assertTableNodeIsSameAsArray(TableNode $table, array $data) $expected = str_replace('%redmine_id%', strval($this->redmine->getVersionId()), $expected); } - $this->assertSame($expected, $value, 'Error with property "' . $row['property'] . '"'); + TestCase::assertSame($expected, $value, 'Error with property "' . $row['property'] . '"'); } } }