Completed
Push — master ( 8a9ad2...75b1ab )
by Richard
02:40
created

LazyAssertionTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
cbo 2
dl 0
loc 38
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A it_collects_errors_until_assertall() 0 16 1
A it_skips_assertions_of_current_chain_after_failure() 0 12 1
1
<?php
2
3
namespace Assert\Tests;
4
5
class LazyAssertionTest extends \PHPUnit_Framework_TestCase
6
{
7
    /**
8
     * @test
9
     */
10
    public function it_collects_errors_until_assertall()
0 ignored issues
show
Coding Style introduced by
Method name "LazyAssertionTest::it_collects_errors_until_assertall" is not in camel caps format
Loading history...
11
    {
12
        $this->setExpectedException('Assert\LazyAssertionException', <<<EXC
13
The following 3 assertions failed:
14
1) foo: Value "10" expected to be string, type integer given.
15
2) bar: Value "<NULL>" is empty, but non empty value was expected.
16
3) baz: Value "string" is not an array.
17
EXC
18
        );
19
20
        \Assert\lazy()
21
            ->that(10, 'foo')->string()
22
            ->that(null, 'bar')->notEmpty()
23
            ->that('string', 'baz')->isArray()
24
            ->verifyNow();
25
    }
26
27
    /**
28
     * @test
29
     */
30
    public function it_skips_assertions_of_current_chain_after_failure()
0 ignored issues
show
Coding Style introduced by
Method name "LazyAssertionTest::it_skips_assertions_of_current_chain_after_failure" is not in camel caps format
Loading history...
31
    {
32
        $this->setExpectedException('Assert\LazyAssertionException', <<<EXC
33
The following 1 assertions failed:
34
1) foo: Value "<NULL>" is empty, but non empty value was expected.
35
EXC
36
        );
37
38
        \Assert\lazy()
39
            ->that(null, 'foo')->notEmpty()->string()
40
            ->verifyNow();
41
    }
42
}
43