X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=vendor%2Fphpunit%2Fphpunit-mock-objects%2Fsrc%2FFramework%2FMockObject%2FMatcher%2FMethodName.php;fp=vendor%2Fphpunit%2Fphpunit-mock-objects%2Fsrc%2FFramework%2FMockObject%2FMatcher%2FMethodName.php;h=1e32c7be1ad540a91dbb8496b93a67aebb308ac6;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/MethodName.php b/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/MethodName.php new file mode 100644 index 000000000..1e32c7be1 --- /dev/null +++ b/vendor/phpunit/phpunit-mock-objects/src/Framework/MockObject/Matcher/MethodName.php @@ -0,0 +1,66 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * Invocation matcher which looks for a specific method name in the invocations. + * + * Checks the method name all incoming invocations, the name is checked against + * the defined constraint $constraint. If the constraint is met it will return + * true in matches(). + * + * @since Class available since Release 1.0.0 + */ +class PHPUnit_Framework_MockObject_Matcher_MethodName extends PHPUnit_Framework_MockObject_Matcher_StatelessInvocation +{ + /** + * @var PHPUnit_Framework_Constraint + */ + protected $constraint; + + /** + * @param PHPUnit_Framework_Constraint|string + * @throws PHPUnit_Framework_Constraint + */ + public function __construct($constraint) + { + if (!$constraint instanceof PHPUnit_Framework_Constraint) { + if (!is_string($constraint)) { + throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string'); + } + + $constraint = new PHPUnit_Framework_Constraint_IsEqual( + $constraint, + 0, + 10, + false, + true + ); + } + + $this->constraint = $constraint; + } + + /** + * @return string + */ + public function toString() + { + return 'method name ' . $this->constraint->toString(); + } + + /** + * @param PHPUnit_Framework_MockObject_Invocation $invocation + * @return bool + */ + public function matches(PHPUnit_Framework_MockObject_Invocation $invocation) + { + return $this->constraint->evaluate($invocation->methodName, '', true); + } +}