| @@ 17-26 (lines=10) @@ | ||
| 14 | static::assertInstanceOf('Graze\ArrayFilter\ArrayFilterInterface', $filter); |
|
| 15 | } |
|
| 16 | ||
| 17 | public function testSingleChildConstructorEqualsMatchesAll() |
|
| 18 | { |
|
| 19 | $filter = new AllOfFilter([ |
|
| 20 | new ClosureFilter('test', function ($actual) { |
|
| 21 | return $actual == 'value'; |
|
| 22 | }), |
|
| 23 | ]); |
|
| 24 | static::assertTrue($filter->matches(['test' => 'value'])); |
|
| 25 | static::assertFalse($filter->matches(['test' => 'values'])); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function testSingleChildAddedLaterEqualsMatchesAll() |
|
| 29 | { |
|
| @@ 28-36 (lines=9) @@ | ||
| 25 | static::assertFalse($filter->matches(['test' => 'values'])); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function testSingleChildAddedLaterEqualsMatchesAll() |
|
| 29 | { |
|
| 30 | $filter = new AllOfFilter(); |
|
| 31 | $filter->addFilter(new ClosureFilter('test', function ($actual) { |
|
| 32 | return $actual == 'value'; |
|
| 33 | })); |
|
| 34 | static::assertTrue($filter->matches(['test' => 'value'])); |
|
| 35 | static::assertFalse($filter->matches(['test' => 'values'])); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function testMultipleChildrenWithDifferentPropertiesMatchesAll() |
|
| 39 | { |
|
| @@ 18-25 (lines=8) @@ | ||
| 15 | static::assertInstanceOf('Graze\ArrayFilter\ArrayFilterInterface', $filter); |
|
| 16 | } |
|
| 17 | ||
| 18 | public function testBasicEquals() |
|
| 19 | { |
|
| 20 | $filter = new ClosureFilter('test', function ($actual) { |
|
| 21 | return $actual == 'value'; |
|
| 22 | }); |
|
| 23 | static::assertTrue($filter->matches(['test' => 'value'])); |
|
| 24 | static::assertFalse($filter->matches(['test' => 'values'])); |
|
| 25 | } |
|
| 26 | ||
| 27 | public function testReturnsFalseWhenInvalidPropertySpecified() |
|
| 28 | { |
|
| @@ 17-26 (lines=10) @@ | ||
| 14 | static::assertInstanceOf('Graze\ArrayFilter\ArrayFilterInterface', $filter); |
|
| 15 | } |
|
| 16 | ||
| 17 | public function testSingleChildConstructorEqualsMatchesOne() |
|
| 18 | { |
|
| 19 | $filter = new OneOfFilter([ |
|
| 20 | new ClosureFilter('test', function ($actual) { |
|
| 21 | return $actual == 'value'; |
|
| 22 | }), |
|
| 23 | ]); |
|
| 24 | static::assertTrue($filter->matches(['test' => 'value'])); |
|
| 25 | static::assertFalse($filter->matches(['test' => 'values'])); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function testSingleChildAddedLaterEqualsMatchesOne() |
|
| 29 | { |
|
| @@ 28-36 (lines=9) @@ | ||
| 25 | static::assertFalse($filter->matches(['test' => 'values'])); |
|
| 26 | } |
|
| 27 | ||
| 28 | public function testSingleChildAddedLaterEqualsMatchesOne() |
|
| 29 | { |
|
| 30 | $filter = new OneOfFilter(); |
|
| 31 | $filter->addFilter(new ClosureFilter('test', function ($actual) { |
|
| 32 | return $actual == 'value'; |
|
| 33 | })); |
|
| 34 | static::assertTrue($filter->matches(['test' => 'value'])); |
|
| 35 | static::assertFalse($filter->matches(['test' => 'values'])); |
|
| 36 | } |
|
| 37 | ||
| 38 | public function testMultipleChildrenWithDifferentPropertiesMatchesOne() |
|
| 39 | { |
|