Completed
Pull Request — 5.6 (#2818)
by Oskar
18:37 queued 03:29
created

SimpleBulkActionTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Kunstmaan\AdminListBundle\Tests\AdminList\BulkAction;
4
5
use Kunstmaan\AdminListBundle\AdminList\BulkAction\SimpleBulkAction;
6
use PHPUnit\Framework\TestCase;
7
8
class SimpleBulkActionTest extends TestCase
9
{
10
    /**
11
     * @var SimpleBulkAction
12
     */
13
    protected $object;
14
15
    protected function setUp()
16
    {
17
        $this->object = new SimpleBulkAction(['https://cia.gov'], 'CIA', 'fa-check', 'some.twig');
18
    }
19
20
    public function testGetters()
21
    {
22
        $this->assertCount(1, $this->object->getUrl());
0 ignored issues
show
Documentation introduced by
$this->object->getUrl() 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...
23
        $this->assertEquals('https://cia.gov', $this->object->getUrl()[0]);
24
        $this->assertEquals('CIA', $this->object->getLabel());
25
        $this->assertEquals('fa-check', $this->object->getIcon());
26
        $this->assertEquals('some.twig', $this->object->getTemplate());
27
    }
28
}
29