| 148 |
lars |
1 |
<?php
|
|
|
2 |
namespace Hamcrest\Text;
|
|
|
3 |
|
|
|
4 |
class IsEqualIgnoringCaseTest extends \Hamcrest\AbstractMatcherTest
|
|
|
5 |
{
|
|
|
6 |
|
|
|
7 |
protected function createMatcher()
|
|
|
8 |
{
|
|
|
9 |
return \Hamcrest\Text\IsEqualIgnoringCase::equalToIgnoringCase('irrelevant');
|
|
|
10 |
}
|
|
|
11 |
|
|
|
12 |
public function testIgnoresCaseOfCharsInString()
|
|
|
13 |
{
|
|
|
14 |
assertThat('HELLO', equalToIgnoringCase('heLLo'));
|
|
|
15 |
assertThat('hello', equalToIgnoringCase('heLLo'));
|
|
|
16 |
assertThat('HelLo', equalToIgnoringCase('heLLo'));
|
|
|
17 |
|
|
|
18 |
assertThat('bye', not(equalToIgnoringCase('heLLo')));
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
public function testFailsIfAdditionalWhitespaceIsPresent()
|
|
|
22 |
{
|
|
|
23 |
assertThat('heLLo ', not(equalToIgnoringCase('heLLo')));
|
|
|
24 |
assertThat(' heLLo', not(equalToIgnoringCase('heLLo')));
|
|
|
25 |
assertThat('hello', not(equalToIgnoringCase(' heLLo')));
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
public function testFailsIfMatchingAgainstNull()
|
|
|
29 |
{
|
|
|
30 |
assertThat(null, not(equalToIgnoringCase('heLLo')));
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
public function testDescribesItselfAsCaseInsensitive()
|
|
|
34 |
{
|
|
|
35 |
$this->assertDescription(
|
|
|
36 |
'equalToIgnoringCase("heLLo")',
|
|
|
37 |
equalToIgnoringCase('heLLo')
|
|
|
38 |
);
|
|
|
39 |
}
|
|
|
40 |
}
|