forked from nette/tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestCase.dataProvider.phpt
52 lines (41 loc) · 1.04 KB
/
TestCase.dataProvider.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
use Tester\Assert;
require __DIR__ . '/bootstrap.php';
class MyTest extends Tester\TestCase
{
public $order;
public function dataProvider()
{
$this->order[] = __METHOD__;
return array(
array(1, 2),
array(3, 4),
);
}
/** @dataProvider dataProvider*/
public function testSingleDataProvider($a, $b)
{
$this->order[] = array(__METHOD__, func_get_args());
}
/**
* @dataProvider dataProvider
* @dataProvider dataProvider
*/
public function testMultipleDataProvider($a, $b)
{
$this->order[] = array(__METHOD__, func_get_args());
}
}
$test = new MyTest;
$test->run();
Assert::same(array(
'MyTest::dataProvider',
array('MyTest::testSingleDataProvider', array(1, 2)),
array('MyTest::testSingleDataProvider', array(3, 4)),
'MyTest::dataProvider',
'MyTest::dataProvider',
array('MyTest::testMultipleDataProvider', array(1, 2)),
array('MyTest::testMultipleDataProvider', array(3, 4)),
array('MyTest::testMultipleDataProvider', array(1, 2)),
array('MyTest::testMultipleDataProvider', array(3, 4)),
), $test->order);