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\Arrays;
3
 
4
use Hamcrest\AbstractMatcherTest;
5
 
6
class IsArrayContainingInOrderTest extends AbstractMatcherTest
7
{
8
 
9
    protected function createMatcher()
10
    {
11
        return IsArrayContainingInOrder::arrayContaining(array(1, 2));
12
    }
13
 
14
    public function testHasAReadableDescription()
15
    {
16
        $this->assertDescription('[<1>, <2>]', arrayContaining(array(1, 2)));
17
    }
18
 
19
    public function testMatchesItemsInOrder()
20
    {
21
        $this->assertMatches(arrayContaining(array(1, 2, 3)), array(1, 2, 3), 'in order');
22
        $this->assertMatches(arrayContaining(array(1)), array(1), 'single');
23
    }
24
 
25
    public function testAppliesMatchersInOrder()
26
    {
27
        $this->assertMatches(
28
            arrayContaining(array(1, 2, 3)),
29
            array(1, 2, 3),
30
            'in order'
31
        );
32
        $this->assertMatches(arrayContaining(array(1)), array(1), 'single');
33
    }
34
 
35
    public function testMismatchesItemsInAnyOrder()
36
    {
37
        if (defined('HHVM_VERSION')) {
38
            $this->markTestSkipped('Broken on HHVM.');
39
        }
40
 
41
        $matcher = arrayContaining(array(1, 2, 3));
42
        $this->assertMismatchDescription('was null', $matcher, null);
43
        $this->assertMismatchDescription('No item matched: <1>', $matcher, array());
44
        $this->assertMismatchDescription('No item matched: <2>', $matcher, array(1));
45
        $this->assertMismatchDescription('item with key 0: was <4>', $matcher, array(4, 3, 2, 1));
46
        $this->assertMismatchDescription('item with key 2: was <4>', $matcher, array(1, 2, 4));
47
    }
48
}