Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
namespace Hamcrest\Text;
3
 
4
class IsEqualIgnoringWhiteSpaceTest extends \Hamcrest\AbstractMatcherTest
5
{
6
 
7
    private $_matcher;
8
 
9
    protected function setUp()
10
    {
11
        $this->_matcher = \Hamcrest\Text\IsEqualIgnoringWhiteSpace::equalToIgnoringWhiteSpace(
12
            "Hello World   how\n are we? "
13
        );
14
    }
15
 
16
    protected function createMatcher()
17
    {
18
        return $this->_matcher;
19
    }
20
 
21
    public function testPassesIfWordsAreSameButWhitespaceDiffers()
22
    {
23
        assertThat('Hello World how are we?', $this->_matcher);
24
        assertThat("   Hello \rWorld \t  how are\nwe?", $this->_matcher);
25
    }
26
 
27
    public function testFailsIfTextOtherThanWhitespaceDiffers()
28
    {
29
        assertThat('Hello PLANET how are we?', not($this->_matcher));
30
        assertThat('Hello World how are we', not($this->_matcher));
31
    }
32
 
33
    public function testFailsIfWhitespaceIsAddedOrRemovedInMidWord()
34
    {
35
        assertThat('HelloWorld how are we?', not($this->_matcher));
36
        assertThat('Hello Wo rld how are we?', not($this->_matcher));
37
    }
38
 
39
    public function testFailsIfMatchingAgainstNull()
40
    {
41
        assertThat(null, not($this->_matcher));
42
    }
43
 
44
    public function testHasAReadableDescription()
45
    {
46
        $this->assertDescription(
47
            "equalToIgnoringWhiteSpace(\"Hello World   how\\n are we? \")",
48
            $this->_matcher
49
        );
50
    }
51
}