From 71d232f6a62ff266e0a66e01929e372f929265dc Mon Sep 17 00:00:00 2001 From: Mehmet Korkmaz Date: Fri, 17 Jul 2020 22:43:45 +0300 Subject: [PATCH] dependencies updated --- composer.json | 10 +- .../_support/_generated/UnitTesterActions.php | 530 +++++++++++++++--- tests/unit/ResolverTest.php | 9 +- tests/unit/SemverTest.php | 3 +- 4 files changed, 455 insertions(+), 97 deletions(-) diff --git a/composer.json b/composer.json index 5803fc8..5bb7829 100644 --- a/composer.json +++ b/composer.json @@ -11,16 +11,16 @@ ], "minimum-stability": "stable", "require": { - "php": "^7.2" + "php": "^7.4" }, "require-dev": { - "codeception/codeception": "^2.5", - "php-coveralls/php-coveralls": "^2.2" + "codeception/codeception": "^4.1", + "php-coveralls/php-coveralls": "^v2.2.0", + "codeception/module-asserts": "^1.2" }, "autoload": { "psr-4": { - "Selami\\Stdlib\\": "src/", - "Selami\\Stdlib\\Exception\\": "src/" + "Selami\\Stdlib\\": "src/" } }, diff --git a/tests/_support/_generated/UnitTesterActions.php b/tests/_support/_generated/UnitTesterActions.php index 3057546..d97f73e 100644 --- a/tests/_support/_generated/UnitTesterActions.php +++ b/tests/_support/_generated/UnitTesterActions.php @@ -1,4 +1,4 @@ -assertEquals(5, $element->getChildrenCount()); + * $I->expectException(MyException::class, function() { + * $this->doSomethingBad(); + * }); + * + * $I->expectException(new MyException(), function() { + * $this->doSomethingBad(); + * }); * ``` + * If you want to check message or exception code, you can pass them with exception instance: + * ```php + * expectException(new MyException("Don't do bad things"), function() { + * $this->doSomethingBad(); + * }); + * ``` + * + * @deprecated Use expectThrowable() instead + * @param $exception string or \Exception + * @param $callback + * @see \Codeception\Module\Asserts::expectException() + */ + public function expectException($exception, $callback) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Handles and checks throwables (Exceptions/Errors) called inside the callback function. + * Either throwable class name or throwable instance should be provided. * - * Floating-point example: * ```php * assertEquals(0.3, $calculator->add(0.1, 0.2), 'Calculator should add the two numbers correctly.', 0.01); + * $I->expectThrowable(MyThrowable::class, function() { + * $this->doSomethingBad(); + * }); + * + * $I->expectThrowable(new MyException(), function() { + * $this->doSomethingBad(); + * }); + * ``` + * If you want to check message or throwable code, you can pass them with throwable instance: + * ```php + * expectThrowable(new MyError("Don't do bad things"), function() { + * $this->doSomethingBad(); + * }); * ``` * + * @param $throwable string or \Throwable + * @param $callback + * @see \Codeception\Module\Asserts::expectThrowable() + */ + public function expectThrowable($throwable, $callback) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('expectThrowable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are equal. + * * @param $expected * @param $actual * @param string $message @@ -46,21 +101,7 @@ public function assertEquals($expected, $actual, $message = null, $delta = null) /** * [!] Method is generated. Documentation taken from corresponding module. * - * Checks that two variables are not equal. If you're comparing floating-point values, - * you can specify the optional "delta" parameter which dictates how great of a precision - * error are you willing to tolerate in order to consider the two values not equal. - * - * Regular example: - * ```php - * assertNotEquals(0, $element->getChildrenCount()); - * ``` - * - * Floating-point example: - * ```php - * assertNotEquals(0.4, $calculator->add(0.1, 0.2), 'Calculator should add the two numbers correctly.', 0.01); - * ``` + * Checks that two variables are not equal * * @param $expected * @param $actual @@ -208,6 +249,22 @@ public function assertRegExp($pattern, $string, $message = null) { } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that string match with pattern + * + * Alias of assertRegExp + * @param string $pattern + * @param string $string + * @param string $message + * @see \Codeception\Module\Asserts::assertMatchesRegularExpression() + */ + public function assertMatchesRegularExpression($pattern, $string, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertMatchesRegularExpression', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -223,6 +280,22 @@ public function assertNotRegExp($pattern, $string, $message = null) { } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that string not match with pattern + * + * Alias of assertNotRegExp + * @param string $pattern + * @param string $string + * @param string $message + * @see \Codeception\Module\Asserts::assertDoesNotMatchRegularExpression() + */ + public function assertDoesNotMatchRegularExpression($pattern, $string, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertDoesNotMatchRegularExpression', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -393,6 +466,21 @@ public function assertFileNotExists($filename, $message = null) { } + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file doesn't exist + * + * Alias of assertFileNotExists + * @param string $filename + * @param string $message + * @see \Codeception\Module\Asserts::assertFileDoesNotExist() + */ + public function assertFileDoesNotExist($filename, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileDoesNotExist', func_get_args())); + } + + /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -457,22 +545,6 @@ public function assertArrayNotHasKey($key, $actual, $description = null) { } - /** - * [!] Method is generated. Documentation taken from corresponding module. - * - * Checks that array contains subset. - * - * @param array $subset - * @param array $array - * @param bool $strict - * @param string $message - * @see \Codeception\Module\Asserts::assertArraySubset() - */ - public function assertArraySubset($subset, $array, $strict = null, $message = null) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); - } - - /** * [!] Method is generated. Documentation taken from corresponding module. * @@ -541,69 +613,351 @@ public function fail($message) { /** * [!] Method is generated. Documentation taken from corresponding module. * - * Handles and checks exception called inside callback function. - * Either exception class name or exception instance should be provided. * - * ```php - * expectException(MyException::class, function() { - * $this->doSomethingBad(); - * }); + * @see \Codeception\Module\Asserts::assertStringContainsString() + */ + public function assertStringContainsString($needle, $haystack, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringContainsString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. * - * $I->expectException(new MyException(), function() { - * $this->doSomethingBad(); - * }); - * ``` - * If you want to check message or exception code, you can pass them with exception instance: - * ```php - * expectException(new MyException("Don't do bad things"), function() { - * $this->doSomethingBad(); - * }); - * ``` * - * @param $exception string or \Exception - * @param $callback + * @see \Codeception\Module\Asserts::assertStringNotContainsString() + */ + public function assertStringNotContainsString($needle, $haystack, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringNotContainsString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. * - * @deprecated Use expectThrowable instead - * @see \Codeception\Module\Asserts::expectException() + * + * @see \Codeception\Module\Asserts::assertStringContainsStringIgnoringCase() */ - public function expectException($exception, $callback) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); + public function assertStringContainsStringIgnoringCase($needle, $haystack, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringContainsStringIgnoringCase', func_get_args())); } /** * [!] Method is generated. Documentation taken from corresponding module. * - * Handles and checks throwables (Exceptions/Errors) called inside the callback function. - * Either throwable class name or throwable instance should be provided. * - * ```php - * expectThrowable(MyThrowable::class, function() { - * $this->doSomethingBad(); - * }); + * @see \Codeception\Module\Asserts::assertStringNotContainsStringIgnoringCase() + */ + public function assertStringNotContainsStringIgnoringCase($needle, $haystack, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringNotContainsStringIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. * - * $I->expectThrowable(new MyException(), function() { - * $this->doSomethingBad(); - * }); - * ``` - * If you want to check message or throwable code, you can pass them with throwable instance: - * ```php - * expectThrowable(new MyError("Don't do bad things"), function() { - * $this->doSomethingBad(); - * }); - * ``` + * @since 1.1.0 of module-asserts + * @see \Codeception\Module\Asserts::assertStringEndsWith() + */ + public function assertStringEndsWith($suffix, $string, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringEndsWith', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. * - * @param $throwable string or \Throwable - * @param $callback - * @see \Codeception\Module\Asserts::expectThrowable() + * @since 1.1.0 of module-asserts + * @see \Codeception\Module\Asserts::assertStringEndsNotWith() */ - public function expectThrowable($throwable, $callback) { - return $this->getScenario()->runStep(new \Codeception\Step\Action('expectThrowable', func_get_args())); + public function assertStringEndsNotWith($suffix, $string, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringEndsNotWith', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsArray() + */ + public function assertIsArray($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsArray', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsBool() + */ + public function assertIsBool($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsBool', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsFloat() + */ + public function assertIsFloat($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsFloat', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsInt() + */ + public function assertIsInt($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsInt', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNumeric() + */ + public function assertIsNumeric($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNumeric', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsObject() + */ + public function assertIsObject($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsObject', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsResource() + */ + public function assertIsResource($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsResource', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsString() + */ + public function assertIsString($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsScalar() + */ + public function assertIsScalar($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsScalar', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsCallable() + */ + public function assertIsCallable($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsCallable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNotArray() + */ + public function assertIsNotArray($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotArray', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNotBool() + */ + public function assertIsNotBool($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotBool', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNotFloat() + */ + public function assertIsNotFloat($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotFloat', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNotInt() + */ + public function assertIsNotInt($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotInt', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNotNumeric() + */ + public function assertIsNotNumeric($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotNumeric', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNotObject() + */ + public function assertIsNotObject($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotObject', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNotResource() + */ + public function assertIsNotResource($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotResource', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNotString() + */ + public function assertIsNotString($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotString', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNotScalar() + */ + public function assertIsNotScalar($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotScalar', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertIsNotCallable() + */ + public function assertIsNotCallable($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsNotCallable', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertEqualsCanonicalizing() + */ + public function assertEqualsCanonicalizing($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEqualsCanonicalizing', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertNotEqualsCanonicalizing() + */ + public function assertNotEqualsCanonicalizing($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEqualsCanonicalizing', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertEqualsIgnoringCase() + */ + public function assertEqualsIgnoringCase($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEqualsIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertNotEqualsIgnoringCase() + */ + public function assertNotEqualsIgnoringCase($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEqualsIgnoringCase', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertEqualsWithDelta() + */ + public function assertEqualsWithDelta($expected, $actual, $delta, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEqualsWithDelta', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * + * @see \Codeception\Module\Asserts::assertNotEqualsWithDelta() + */ + public function assertNotEqualsWithDelta($expected, $actual, $delta, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEqualsWithDelta', func_get_args())); } } diff --git a/tests/unit/ResolverTest.php b/tests/unit/ResolverTest.php index 8c6bc30..4139ba5 100644 --- a/tests/unit/ResolverTest.php +++ b/tests/unit/ResolverTest.php @@ -46,27 +46,30 @@ public function typeHintDataProvider() : array /** * @test - * @expectedException InvalidArgumentException */ public function getTypeHintClassesShouldThrowExceptionForNonExistingClass() : void { + $this->expectException(\InvalidArgumentException::class); + Selami\Stdlib\Resolver::getParameterHints('NonExistingClass', '__construct'); } /** * @test - * @expectedException InvalidArgumentException */ public function getTypeHintClassesShouldThrowExceptionForNonExistingMethod() : void { + $this->expectException(\InvalidArgumentException::class); + Selami\Stdlib\Resolver::getParameterHints(TypeHintedClass::class, 'nonExistingMethod'); } /** * @test - * @expectedException InvalidArgumentException */ public function getTypeHintClassesShouldThrowExceptionForNonExistingClassHint() : void { + $this->expectException(\InvalidArgumentException::class); + Selami\Stdlib\Resolver::getParameterHints(TypeHintedClass::class, 'method2'); } } diff --git a/tests/unit/SemverTest.php b/tests/unit/SemverTest.php index 23c96f7..81461b5 100644 --- a/tests/unit/SemverTest.php +++ b/tests/unit/SemverTest.php @@ -1,6 +1,7 @@ expectException(InvalidSemverPatternException::class); $version = '2.0.a'; $semver = Semver::createFromString($version); $this->assertEquals('3.0.6', $semver->getNextMajorRelease());