Completed
Pull Request — 5.7 (#2814)
by Oskar
39:53 queued 24:51
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
    /**
16
     * Sets up the fixture, for example, opens a network connection.
17
     * This method is called before a test is executed.
18
     */
19
    protected function setUp(): void
20
    {
21
        $this->object = new SimpleBulkAction(['https://cia.gov'], 'CIA', 'fa-check', 'some.twig');
22
    }
23
24
    public function testGetters()
25
    {
26
        $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...
27
        $this->assertEquals('https://cia.gov', $this->object->getUrl()[0]);
28
        $this->assertEquals('CIA', $this->object->getLabel());
29
        $this->assertEquals('fa-check', $this->object->getIcon());
30
        $this->assertEquals('some.twig', $this->object->getTemplate());
31
    }
32
}
33