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 StringContainsInOrderTest extends \Hamcrest\AbstractMatcherTest
5
{
6
 
7
    private $_m;
8
 
9
    protected function setUp()
10
    {
11
        $this->_m = \Hamcrest\Text\StringContainsInOrder::stringContainsInOrder(array('a', 'b', 'c'));
12
    }
13
 
14
    protected function createMatcher()
15
    {
16
        return $this->_m;
17
    }
18
 
19
    public function testMatchesOnlyIfStringContainsGivenSubstringsInTheSameOrder()
20
    {
21
        $this->assertMatches($this->_m, 'abc', 'substrings in order');
22
        $this->assertMatches($this->_m, '1a2b3c4', 'substrings separated');
23
 
24
        $this->assertDoesNotMatch($this->_m, 'cab', 'substrings out of order');
25
        $this->assertDoesNotMatch($this->_m, 'xyz', 'no substrings in string');
26
        $this->assertDoesNotMatch($this->_m, 'ac', 'substring missing');
27
        $this->assertDoesNotMatch($this->_m, '', 'empty string');
28
    }
29
 
30
    public function testAcceptsVariableArguments()
31
    {
32
        $this->assertMatches(stringContainsInOrder('a', 'b', 'c'), 'abc', 'substrings as variable arguments');
33
    }
34
 
35
    public function testHasAReadableDescription()
36
    {
37
        $this->assertDescription(
38
            'a string containing "a", "b", "c" in order',
39
            $this->_m
40
        );
41
    }
42
}