| 148 |
lars |
1 |
<?php
|
|
|
2 |
namespace Hamcrest\Core;
|
|
|
3 |
|
|
|
4 |
class IsNotTest extends \Hamcrest\AbstractMatcherTest
|
|
|
5 |
{
|
|
|
6 |
|
|
|
7 |
protected function createMatcher()
|
|
|
8 |
{
|
|
|
9 |
return \Hamcrest\Core\IsNot::not('something');
|
|
|
10 |
}
|
|
|
11 |
|
|
|
12 |
public function testEvaluatesToTheTheLogicalNegationOfAnotherMatcher()
|
|
|
13 |
{
|
|
|
14 |
$this->assertMatches(not(equalTo('A')), 'B', 'should match');
|
|
|
15 |
$this->assertDoesNotMatch(not(equalTo('B')), 'B', 'should not match');
|
|
|
16 |
}
|
|
|
17 |
|
|
|
18 |
public function testProvidesConvenientShortcutForNotEqualTo()
|
|
|
19 |
{
|
|
|
20 |
$this->assertMatches(not('A'), 'B', 'should match');
|
|
|
21 |
$this->assertMatches(not('B'), 'A', 'should match');
|
|
|
22 |
$this->assertDoesNotMatch(not('A'), 'A', 'should not match');
|
|
|
23 |
$this->assertDoesNotMatch(not('B'), 'B', 'should not match');
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
public function testUsesDescriptionOfNegatedMatcherWithPrefix()
|
|
|
27 |
{
|
|
|
28 |
$this->assertDescription('not a value greater than <2>', not(greaterThan(2)));
|
|
|
29 |
$this->assertDescription('not "A"', not('A'));
|
|
|
30 |
}
|
|
|
31 |
}
|