From 287f07dba6fea2200f78a1614ecd131e98f98abe Mon Sep 17 00:00:00 2001 From: Kacper Donat Date: Wed, 11 Jul 2018 18:11:47 +0200 Subject: [PATCH] add phpunit config --- phpunit.xml | 0 tests/ConstantPredicateTest.php | 16 ++-------------- tests/RandomDataTrait.php | 25 +++++++++++++++++++++++++ tests/bootstrap.php | 11 +++++++++++ 4 files changed, 38 insertions(+), 14 deletions(-) create mode 100644 phpunit.xml create mode 100644 tests/RandomDataTrait.php create mode 100644 tests/bootstrap.php diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..e69de29 diff --git a/tests/ConstantPredicateTest.php b/tests/ConstantPredicateTest.php index 10a46f6..752e3f1 100644 --- a/tests/ConstantPredicateTest.php +++ b/tests/ConstantPredicateTest.php @@ -12,6 +12,8 @@ use Kadet\Functional\Predicate\ConstantPredicate; class ConstantPredicateTest extends PHPUnit\Framework\TestCase { + use RandomDataTrait; + private function getTestPredicate() { return function ($arg = null) { @@ -19,20 +21,6 @@ class ConstantPredicateTest extends PHPUnit\Framework\TestCase }; } - public function randomDataProvider() - { - return [ - ['x'], - [false], - [true], - [], - [(object)[]], - [false, true], - [null, true], - [2321321] - ]; - } - /** * @dataProvider randomDataProvider */ diff --git a/tests/RandomDataTrait.php b/tests/RandomDataTrait.php new file mode 100644 index 0000000..4c29765 --- /dev/null +++ b/tests/RandomDataTrait.php @@ -0,0 +1,25 @@ + + * + * Full license available in separate LICENSE file + */ + +trait RandomDataTrait +{ + public function randomDataProvider() + { + return [ + ['x'], + [false], + [true], + [], + [(object)[]], + [false, true], + [null, true], + [2321321] + ]; + } +} \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..15a3996 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,11 @@ + + * + * Full license available in separate LICENSE file + */ + +require_once __DIR__.'/../vendor/autoload.php'; +require_once __DIR__.'/RandomDataTrait.php'; \ No newline at end of file