ImageRendererTraitTest::testRenderImage()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 9
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the jquery-datatables-bundle package.
5
 *
6
 * (c) 2021 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\JQuery\DataTablesBundle\Tests\Renderer\Assets;
13
14
use WBW\Bundle\JQuery\DataTablesBundle\Tests\AbstractTestCase;
15
use WBW\Bundle\JQuery\DataTablesBundle\Tests\Fixtures\Renderer\Assets\TestImageRendererTrait;
16
17
/**
18
 * Image renderer trait test.
19
 *
20
 * @author webeweb <https://github.com/webeweb>
21
 * @package WBW\Bundle\JQuery\DataTablesBundle\Tests\Renderer\Assets
22
 */
23
class ImageRendererTraitTest extends AbstractTestCase {
24
25
    /**
26
     * Test renderImage()
27
     *
28
     * @return void
29
     */
30
    public function testRenderImage(): void {
31
32
        $obj = new TestImageRendererTrait();
33
34
        $this->assertNull($obj->renderImage(null));
0 ignored issues
show
Bug introduced by
Are you sure the usage of $obj->renderImage(null) targeting WBW\Bundle\JQuery\DataTa...rerTrait::renderImage() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
35
        $this->assertEquals('<img src="src"/>', $obj->renderImage("src"));
36
        $this->assertEquals('<img src="src" alt="alt"/>', $obj->renderImage("src", "alt"));
37
        $this->assertEquals('<img src="src" alt="alt" width="width"/>', $obj->renderImage("src", "alt", "width"));
38
        $this->assertEquals('<img src="src" alt="alt" width="width" height="height"/>', $obj->renderImage("src", "alt", "width", "height"));
39
    }
40
}
41