This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from codisart/add-test-filter
Clean some code and add some unit tests.
- Loading branch information
Showing
5 changed files
with
45 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* @see https://github.com/zendframework/zend-hydrator for the canonical source repository | ||
* @copyright Copyright (c) 2018 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license https://github.com/zendframework/zend-hydrator/blob/master/LICENSE.md New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Hydrator\Filter; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Zend\Hydrator\Filter\MethodMatchFilter; | ||
|
||
class MethodMatchFilterTest extends TestCase | ||
{ | ||
public function providerFilter() | ||
{ | ||
return [ | ||
['foo', true,], | ||
['bar', false,], | ||
['class::foo', true,], | ||
['class::bar', false,], | ||
]; | ||
} | ||
|
||
/** | ||
* @dataProvider providerFilter | ||
*/ | ||
public function testFilter($methodName, $expected) | ||
{ | ||
$testedInstance = new MethodMatchFilter('foo', false); | ||
self::assertEquals($expected, $testedInstance->filter($methodName)); | ||
|
||
$testedInstance = new MethodMatchFilter('foo', true); | ||
self::assertEquals(! $expected, $testedInstance->filter($methodName)); | ||
} | ||
} |