Completed
Push — master ( 3f89d7...f790e9 )
by Mike
30:28 queued 29:00
created

FirstOrCreateTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFirstOrCreateFlushesCacheForModel() 0 20 2
1
<?php namespace GeneaLabs\LaravelModelCaching\Tests\Integration\CachedBuilder;
2
3
use GeneaLabs\LaravelModelCaching\Tests\Fixtures\Author;
4
use GeneaLabs\LaravelModelCaching\Tests\IntegrationTestCase;
5
6
class FirstOrCreateTest extends IntegrationTestCase
7
{
8
    public function testFirstOrCreateFlushesCacheForModel()
9
    {
10
        (new Author)->truncate();
11
12
        $items = [
13
            ['name' => 'foo', 'email' => '[email protected]'],
14
            ['name' => 'foo', 'email' => '[email protected]'],
15
            ['name' => 'foo', 'email' => '[email protected]'],
16
            ['name' => 'foo', 'email' => '[email protected]'],
17
            ['name' => 'foo', 'email' => '[email protected]'],
18
        ];
19
20
        foreach ($items as $item) {
21
            (new Author)->firstOrCreate($item);
22
        }
23
24
        $authors = (new Author)->get();
25
26
        $this->assertEquals(5, $authors->count());
27
    }
28
}
29