| 148 |
lars |
1 |
<?php
|
|
|
2 |
namespace Hamcrest\Core;
|
|
|
3 |
|
|
|
4 |
class IsTest extends \Hamcrest\AbstractMatcherTest
|
|
|
5 |
{
|
|
|
6 |
|
|
|
7 |
protected function createMatcher()
|
|
|
8 |
{
|
|
|
9 |
return \Hamcrest\Core\Is::is('something');
|
|
|
10 |
}
|
|
|
11 |
|
|
|
12 |
public function testJustMatchesTheSameWayTheUnderylingMatcherDoes()
|
|
|
13 |
{
|
|
|
14 |
$this->assertMatches(is(equalTo(true)), true, 'should match');
|
|
|
15 |
$this->assertMatches(is(equalTo(false)), false, 'should match');
|
|
|
16 |
$this->assertDoesNotMatch(is(equalTo(true)), false, 'should not match');
|
|
|
17 |
$this->assertDoesNotMatch(is(equalTo(false)), true, 'should not match');
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
public function testGeneratesIsPrefixInDescription()
|
|
|
21 |
{
|
|
|
22 |
$this->assertDescription('is <true>', is(equalTo(true)));
|
|
|
23 |
}
|
|
|
24 |
|
|
|
25 |
public function testProvidesConvenientShortcutForIsEqualTo()
|
|
|
26 |
{
|
|
|
27 |
$this->assertMatches(is('A'), 'A', 'should match');
|
|
|
28 |
$this->assertMatches(is('B'), 'B', 'should match');
|
|
|
29 |
$this->assertDoesNotMatch(is('A'), 'B', 'should not match');
|
|
|
30 |
$this->assertDoesNotMatch(is('B'), 'A', 'should not match');
|
|
|
31 |
$this->assertDescription('is "A"', is('A'));
|
|
|
32 |
}
|
|
|
33 |
}
|