File: IsEmptyStringTest.php

package info (click to toggle)
php-hamcrest 2.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,168 kB
  • sloc: php: 6,353; makefile: 14; sh: 9
file content (86 lines) | stat: -rw-r--r-- 2,299 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
namespace Hamcrest\Text;

class IsEmptyStringTest extends \Hamcrest\AbstractMatcherTestCase
{

    protected function createMatcher()
    {
        return \Hamcrest\Text\IsEmptyString::isEmptyOrNullString();
    }

    public function testEmptyDoesNotMatchNull()
    {
        $this->assertDoesNotMatch(emptyString(), null, 'null');
    }

    public function testEmptyDoesNotMatchZero()
    {
        $this->assertDoesNotMatch(emptyString(), 0, 'zero');
    }

    public function testEmptyDoesNotMatchFalse()
    {
        $this->assertDoesNotMatch(emptyString(), false, 'false');
    }

    public function testEmptyDoesNotMatchEmptyArray()
    {
        $this->assertDoesNotMatch(emptyString(), array(), 'empty array');
    }

    public function testEmptyMatchesEmptyString()
    {
        $this->assertMatches(emptyString(), '', 'empty string');
    }

    public function testEmptyDoesNotMatchNonEmptyString()
    {
        $this->assertDoesNotMatch(emptyString(), 'foo', 'non-empty string');
    }

    public function testEmptyHasAReadableDescription()
    {
        $this->assertDescription('an empty string', emptyString());
    }

    public function testEmptyOrNullMatchesNull()
    {
        $this->assertMatches(nullOrEmptyString(), null, 'null');
    }

    public function testEmptyOrNullMatchesEmptyString()
    {
        $this->assertMatches(nullOrEmptyString(), '', 'empty string');
    }

    public function testEmptyOrNullDoesNotMatchNonEmptyString()
    {
        $this->assertDoesNotMatch(nullOrEmptyString(), 'foo', 'non-empty string');
    }

    public function testEmptyOrNullHasAReadableDescription()
    {
        $this->assertDescription('(null or an empty string)', nullOrEmptyString());
    }

    public function testNonEmptyDoesNotMatchNull()
    {
        $this->assertDoesNotMatch(nonEmptyString(), null, 'null');
    }

    public function testNonEmptyDoesNotMatchEmptyString()
    {
        $this->assertDoesNotMatch(nonEmptyString(), '', 'empty string');
    }

    public function testNonEmptyMatchesNonEmptyString()
    {
        $this->assertMatches(nonEmptyString(), 'foo', 'non-empty string');
    }

    public function testNonEmptyHasAReadableDescription()
    {
        $this->assertDescription('a non-empty string', nonEmptyString());
    }
}