add phpunit config

This commit is contained in:
Kacper Donat 2018-07-11 18:11:47 +02:00
parent 1a0c6a5bc8
commit 287f07dba6
4 changed files with 38 additions and 14 deletions

0
phpunit.xml Normal file
View File

View File

@ -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
*/

25
tests/RandomDataTrait.php Normal file
View File

@ -0,0 +1,25 @@
<?php
/**
* Copyright 2018 Kacper Donat
*
* @author Kacper "Kadet" Donat <kacper@kadet.net>
*
* Full license available in separate LICENSE file
*/
trait RandomDataTrait
{
public function randomDataProvider()
{
return [
['x'],
[false],
[true],
[],
[(object)[]],
[false, true],
[null, true],
[2321321]
];
}
}

11
tests/bootstrap.php Normal file
View File

@ -0,0 +1,11 @@
<?php
/**
* Copyright 2018 Kacper Donat
*
* @author Kacper "Kadet" Donat <kacper@kadet.net>
*
* Full license available in separate LICENSE file
*/
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__.'/RandomDataTrait.php';