12 namespace Symfony\Component\Finder\Tests\Comparator;
22 $comparator->setOperator(
'foo');
23 $this->fail(
'->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
24 }
catch (\Exception $e) {
25 $this->assertInstanceOf(
'InvalidArgumentException', $e,
'->setOperator() throws an \InvalidArgumentException if the operator is not valid.');
29 $comparator->setOperator(
'>');
30 $this->assertEquals(
'>', $comparator->getOperator(),
'->getOperator() returns the current operator');
36 $comparator->setTarget(8);
37 $this->assertEquals(8, $comparator->getTarget(),
'->getTarget() returns the target');
43 public function testTest($operator, $target, $match, $noMatch)
46 $c->setOperator($operator);
47 $c->setTarget($target);
49 foreach ($match as $m) {
50 $this->assertTrue($c->test($m),
'->test() tests a string against the expression');
53 foreach ($noMatch as $m) {
54 $this->assertFalse($c->test($m),
'->test() tests a string against the expression');
61 array(
'<',
'1000', array(
'500',
'999'), array(
'1000',
'1500')),