Passed
Push — master ( 871cbe...1ad68b )
by Gabriel
05:12
created

EmailsTraitTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 8
c 1
b 0
f 0
dl 0
loc 15
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_sent_no_on_insert() 0 13 1
1
<?php
2
3
namespace Nip\MailModule\Tests\EmailsTable;
4
5
use Mockery\Mock;
6
use Nip\Database\Query\Insert;
7
use Nip\MailModule\Tests\AbstractTest;
8
use Nip\MailModule\Tests\Fixtures\Models\Emails\Email;
9
use Nip\MailModule\Tests\Fixtures\Models\Emails\Emails;
10
11
/**
12
 * Class EmailsTraitTest
13
 * @package Nip\MailModule\Tests\EmailsTable
14
 */
15
class EmailsTraitTest extends AbstractTest
16
{
17
    public function test_sent_no_on_insert()
18
    {
19
        $email = new Email();
20
21
        /** @var Emails|Mock $emails */
22
        $emails = \Mockery::mock(Emails::class)->shouldAllowMockingProtectedMethods()->makePartial();
23
        $emails->shouldReceive('insertQuery')->andReturn(new Insert());
24
        $emails->shouldReceive('performInsert')->andReturn(true);
25
26
        $emails->bootEmailsTrait();
27
28
        $emails->insert($email);
29
        self::assertSame('no', $email->get('sent'));
30
    }
31
}