Passed
Push — master ( deb522...4fcdf3 )
by Gabriel
02:32
created

AbstractLazyCollectionTest::test_doLoad()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 3
c 1
b 0
f 1
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Nip\Collections\Tests\Lazy;
4
5
use Nip\Collections\Tests\AbstractTest;
6
use Nip\Collections\Tests\Fixtures\LazyCollection;
7
8
/**
9
 * Class AbstractLazyCollectionTest
10
 * @package Nip\Collections\Tests\Lazy
11
 */
12
class AbstractLazyCollectionTest extends AbstractTest
13
{
14
    public function test_lazy()
15
    {
16
        $mock = \Mockery::mock(LazyCollection::class)->shouldAllowMockingProtectedMethods()->makePartial();
17
        $mock->shouldReceive('doLoad')->never();
18
19
        self::assertInstanceOf(LazyCollection::class, $mock);
20
//        self::assertSame(0, $mock->count());
21
    }
22
23
    public function test_doLoad_once()
24
    {
25
        $mock = \Mockery::mock(LazyCollection::class)->shouldAllowMockingProtectedMethods()->makePartial();
26
        $mock->shouldReceive('doLoad')->once();
27
28
        self::assertInstanceOf(LazyCollection::class, $mock);
29
        self::assertSame(0, $mock->count());
30
        self::assertSame(0, $mock->count());
31
        self::assertSame(0, $mock->count());
32
        self::assertSame(0, $mock->count());
33
    }
34
35
    public function test_doLoad()
36
    {
37
        $collection = new LazyCollection();
38
        self::assertInstanceOf(LazyCollection::class, $collection);
39
        self::assertSame(2, $collection->count());
40
    }
41
}
42