diff options
author | Olivier Paroz <github@oparoz.com> | 2015-08-10 01:42:03 +0300 |
---|---|---|
committer | Olivier Paroz <github@oparoz.com> | 2015-08-10 01:42:03 +0300 |
commit | a8b1af48860f359435fa451fa9c765c420b3dd33 (patch) | |
tree | 19f5c624b84b3c141ffb748510056678d5abe795 /tests/_support | |
parent | 9f69bde62dafc02d1b52e54b2660e230babd85a5 (diff) |
Switch to Codeception for testing
Diffstat (limited to 'tests/_support')
-rw-r--r-- | tests/_support/FunctionalTester.php | 26 | ||||
-rw-r--r-- | tests/_support/Helper/Functional.php | 9 | ||||
-rw-r--r-- | tests/_support/Helper/Integration.php | 9 | ||||
-rw-r--r-- | tests/_support/Helper/Unit.php | 9 | ||||
-rw-r--r-- | tests/_support/IntegrationTester.php | 26 | ||||
-rw-r--r-- | tests/_support/UnitTester.php | 26 | ||||
-rw-r--r-- | tests/_support/_generated/FunctionalTesterActions.php | 18 | ||||
-rw-r--r-- | tests/_support/_generated/IntegrationTesterActions.php | 18 | ||||
-rw-r--r-- | tests/_support/_generated/UnitTesterActions.php | 348 |
9 files changed, 489 insertions, 0 deletions
diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php new file mode 100644 index 00000000..8f9d5f23 --- /dev/null +++ b/tests/_support/FunctionalTester.php @@ -0,0 +1,26 @@ +<?php + + +/** + * Inherited Methods + * @method void wantToTest($text) + * @method void wantTo($text) + * @method void execute($callable) + * @method void expectTo($prediction) + * @method void expect($prediction) + * @method void amGoingTo($argumentation) + * @method void am($role) + * @method void lookForwardTo($achieveValue) + * @method void comment($description) + * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) + * + * @SuppressWarnings(PHPMD) +*/ +class FunctionalTester extends \Codeception\Actor +{ + use _generated\FunctionalTesterActions; + + /** + * Define custom actions here + */ +} diff --git a/tests/_support/Helper/Functional.php b/tests/_support/Helper/Functional.php new file mode 100644 index 00000000..34fbe736 --- /dev/null +++ b/tests/_support/Helper/Functional.php @@ -0,0 +1,9 @@ +<?php +namespace Helper; +// here you can define custom actions +// all public methods declared in helper class will be available in $I + +class Functional extends \Codeception\Module +{ + +} diff --git a/tests/_support/Helper/Integration.php b/tests/_support/Helper/Integration.php new file mode 100644 index 00000000..db4f4f38 --- /dev/null +++ b/tests/_support/Helper/Integration.php @@ -0,0 +1,9 @@ +<?php +namespace Helper; +// here you can define custom actions +// all public methods declared in helper class will be available in $I + +class Integration extends \Codeception\Module +{ + +} diff --git a/tests/_support/Helper/Unit.php b/tests/_support/Helper/Unit.php new file mode 100644 index 00000000..4862e82d --- /dev/null +++ b/tests/_support/Helper/Unit.php @@ -0,0 +1,9 @@ +<?php +namespace Helper; +// here you can define custom actions +// all public methods declared in helper class will be available in $I + +class Unit extends \Codeception\Module +{ + +} diff --git a/tests/_support/IntegrationTester.php b/tests/_support/IntegrationTester.php new file mode 100644 index 00000000..7befb5d5 --- /dev/null +++ b/tests/_support/IntegrationTester.php @@ -0,0 +1,26 @@ +<?php + + +/** + * Inherited Methods + * @method void wantToTest($text) + * @method void wantTo($text) + * @method void execute($callable) + * @method void expectTo($prediction) + * @method void expect($prediction) + * @method void amGoingTo($argumentation) + * @method void am($role) + * @method void lookForwardTo($achieveValue) + * @method void comment($description) + * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) + * + * @SuppressWarnings(PHPMD) +*/ +class IntegrationTester extends \Codeception\Actor +{ + use _generated\IntegrationTesterActions; + + /** + * Define custom actions here + */ +} diff --git a/tests/_support/UnitTester.php b/tests/_support/UnitTester.php new file mode 100644 index 00000000..68c09cf8 --- /dev/null +++ b/tests/_support/UnitTester.php @@ -0,0 +1,26 @@ +<?php + + +/** + * Inherited Methods + * @method void wantToTest($text) + * @method void wantTo($text) + * @method void execute($callable) + * @method void expectTo($prediction) + * @method void expect($prediction) + * @method void amGoingTo($argumentation) + * @method void am($role) + * @method void lookForwardTo($achieveValue) + * @method void comment($description) + * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) + * + * @SuppressWarnings(PHPMD) +*/ +class UnitTester extends \Codeception\Actor +{ + use _generated\UnitTesterActions; + + /** + * Define custom actions here + */ +} diff --git a/tests/_support/_generated/FunctionalTesterActions.php b/tests/_support/_generated/FunctionalTesterActions.php new file mode 100644 index 00000000..b173aff6 --- /dev/null +++ b/tests/_support/_generated/FunctionalTesterActions.php @@ -0,0 +1,18 @@ +<?php //[STAMP] a07099654f5bd84fd862472e6a030b65 +namespace _generated; + +// This class was automatically generated by build task +// You should not change it manually as it will be overwritten on next build +// @codingStandardsIgnoreFile + +use Helper\Functional; + +trait FunctionalTesterActions +{ + /** + * @return \Codeception\Scenario + */ + abstract protected function getScenario(); + + +} diff --git a/tests/_support/_generated/IntegrationTesterActions.php b/tests/_support/_generated/IntegrationTesterActions.php new file mode 100644 index 00000000..bf674453 --- /dev/null +++ b/tests/_support/_generated/IntegrationTesterActions.php @@ -0,0 +1,18 @@ +<?php //[STAMP] 45011971cfb225d39d739baf8ae90231 +namespace _generated; + +// This class was automatically generated by build task +// You should not change it manually as it will be overwritten on next build +// @codingStandardsIgnoreFile + +use Helper\Integration; + +trait IntegrationTesterActions +{ + /** + * @return \Codeception\Scenario + */ + abstract protected function getScenario(); + + +} diff --git a/tests/_support/_generated/UnitTesterActions.php b/tests/_support/_generated/UnitTesterActions.php new file mode 100644 index 00000000..0c066a7e --- /dev/null +++ b/tests/_support/_generated/UnitTesterActions.php @@ -0,0 +1,348 @@ +<?php //[STAMP] f0237876407d9a8a0491dbbedcdcbf19 +namespace _generated; + +// This class was automatically generated by build task +// You should not change it manually as it will be overwritten on next build +// @codingStandardsIgnoreFile + +use Codeception\Module\Asserts; +use Helper\Unit; + +trait UnitTesterActions +{ + /** + * @return \Codeception\Scenario + */ + abstract protected function getScenario(); + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are equal. + * + * @param $expected + * @param $actual + * @param string $message + * + * @return mixed + * @see \Codeception\Module\Asserts::assertEquals() + */ + public function assertEquals($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are not equal + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotEquals() + */ + public function assertNotEquals($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are same + * + * @param $expected + * @param $actual + * @param string $message + * + * @return mixed + * @see \Codeception\Module\Asserts::assertSame() + */ + public function assertSame($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that two variables are not same + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotSame() + */ + public function assertNotSame($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is greater than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertGreaterThan() + */ + public function assertGreaterThan($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @deprecated + * @see \Codeception\Module\Asserts::assertGreaterThen() + */ + public function assertGreaterThen($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThen', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is greater or equal than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() + */ + public function assertGreaterThanOrEqual($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * @deprecated + * @see \Codeception\Module\Asserts::assertGreaterThenOrEqual() + */ + public function assertGreaterThenOrEqual($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThenOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is less than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertLessThan() + */ + public function assertLessThan($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that actual is less or equal than expected + * + * @param $expected + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertLessThanOrEqual() + */ + public function assertLessThanOrEqual($expected, $actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that haystack contains needle + * + * @param $needle + * @param $haystack + * @param string $message + * @see \Codeception\Module\Asserts::assertContains() + */ + public function assertContains($needle, $haystack, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that haystack doesn't contain needle. + * + * @param $needle + * @param $haystack + * @param string $message + * @see \Codeception\Module\Asserts::assertNotContains() + */ + public function assertNotContains($needle, $haystack, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that string match with pattern + * + * @param string $pattern + * @param string $string + * @param string $message + * @see \Codeception\Module\Asserts::assertRegExp() + */ + public function assertRegExp($pattern, $string, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that string not match with pattern + * + * @param string $pattern + * @param string $string + * @param string $message + * @see \Codeception\Module\Asserts::assertNotRegExp() + */ + public function assertNotRegExp($pattern, $string, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is empty. + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertEmpty() + */ + public function assertEmpty($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is not empty. + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotEmpty() + */ + public function assertNotEmpty($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is NULL + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNull() + */ + public function assertNull($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that variable is not NULL + * + * @param $actual + * @param string $message + * @see \Codeception\Module\Asserts::assertNotNull() + */ + public function assertNotNull($actual, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that condition is positive. + * + * @param $condition + * @param string $message + * @see \Codeception\Module\Asserts::assertTrue() + */ + public function assertTrue($condition, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks that condition is negative. + * + * @param $condition + * @param string $message + * @see \Codeception\Module\Asserts::assertFalse() + */ + public function assertFalse($condition, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file exists + * + * @param string $filename + * @param string $message + * @see \Codeception\Module\Asserts::assertFileExists() + */ + public function assertFileExists($filename, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Checks if file doesn't exists + * + * @param string $filename + * @param string $message + * @see \Codeception\Module\Asserts::assertFileNotExists() + */ + public function assertFileNotExists($filename, $message = null) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); + } + + + /** + * [!] Method is generated. Documentation taken from corresponding module. + * + * Fails the test with message. + * + * @param $message + * @see \Codeception\Module\Asserts::fail() + */ + public function fail($message) { + return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); + } +} |