EmailsTraitTest   A
last analyzed

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;
0 ignored issues
show
Bug introduced by
The type Mockery\Mock was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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();
0 ignored issues
show
Bug introduced by
The type Mockery was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
23
        $emails->shouldReceive('insertQuery')->andReturn(new Insert());
0 ignored issues
show
Bug introduced by
The method andReturn() does not exist on Nip\Records\Collections\Collection. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        $emails->shouldReceive('insertQuery')->/** @scrutinizer ignore-call */ andReturn(new Insert());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
Bug introduced by
The method andReturn() does not exist on Nip\MailModule\Tests\Fixtures\Models\Emails\Emails. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        $emails->shouldReceive('insertQuery')->/** @scrutinizer ignore-call */ andReturn(new Insert());
Loading history...
Bug introduced by
The method shouldReceive() does not exist on Nip\MailModule\Tests\Fixtures\Models\Emails\Emails. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        $emails->/** @scrutinizer ignore-call */ 
24
                 shouldReceive('insertQuery')->andReturn(new Insert());
Loading history...
24
        $emails->shouldReceive('performInsert')->andReturn(true);
25
26
        $emails->bootEmailsTrait();
27
28
        $emails->insert($email);
29
        self::assertSame('no', $email->get('sent'));
30
    }
31
}