Completed
Push — master ( f7bed6...7b8b9a )
by Gabriel
05:48 queued 11s
created

RecordTraitTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_buildMailMessageMergeTags_strip_not_present() 0 12 1
1
<?php
2
3
namespace Nip\Mail\Tests\Models\Mailable;
4
5
use Nip\Mail\Tests\AbstractTest;
6
use Nip\Mail\Tests\Fixtures\Models\Emails\Email;
7
8
/**
9
 * Class RecordTraitTest
10
 * @package Nip\Mail\Tests\Models\Mailable
11
 */
12
class RecordTraitTest extends AbstractTest
13
{
14
    public function test_buildMailMessageMergeTags_strip_not_present()
15
    {
16
        $email = new Email();
17
        $email->setBody('{{var1}}{{var3}}');
18
        $email->setMergeTags(['var1' => 1, 'var2' => 2, 'var3' => 3]);
19
20
        $message = $email->newMailMessage();
21
        $email->buildMailMessageMergeTags($message);
22
23
        $tags = $message->getMergeTags();
24
        self::assertCount(2, $tags);
0 ignored issues
show
Documentation introduced by
$tags is of type array, but the function expects a object<Countable>|object...nit\Framework\iterable>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
25
    }
26
}
27