1 | <?php |
||
9 | abstract class NodeSimplifierBaseTest extends \PHPUnit_Framework_TestCase { |
||
10 | |||
11 | /** |
||
12 | * @return NodeSimplifier |
||
13 | */ |
||
14 | protected abstract function buildSimplifier(); |
||
15 | |||
16 | public function testImplementsNodeSimplifierInterface() { |
||
19 | |||
20 | /** |
||
21 | * @dataProvider simplifiableProvider |
||
22 | */ |
||
23 | public function testIsNodeSimplifierForReturnsTrue($simplifiable) { |
||
26 | |||
27 | public abstract function simplifiableProvider(); |
||
28 | |||
29 | /** |
||
30 | * @dataProvider nonSimplifiableProvider |
||
31 | */ |
||
32 | public function testIsNodeSimplifierForReturnsFalse($nonSimplifiable) { |
||
35 | |||
36 | /** |
||
37 | * @dataProvider nonSimplifiableProvider |
||
38 | */ |
||
39 | public function testSimplificationThrowsUnsupportedObjectException($nonSimplifiable) { |
||
43 | |||
44 | /** |
||
45 | * @return array |
||
46 | */ |
||
47 | public abstract function nonSimplifiableProvider(); |
||
48 | |||
49 | /** |
||
50 | * @dataProvider simplificationProvider |
||
51 | */ |
||
52 | public function testSimplification($simplified, $object) { |
||
53 | $this->assertEquals( |
||
54 | $simplified, |
||
55 | $this->buildSimplifier()->simplify($object) |
||
56 | ); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @return array |
||
61 | */ |
||
62 | public abstract function simplificationProvider(); |
||
63 | } |
||
64 |