Issues (117)

Tests/Renderer/DateTimes/DateRendererTraitTest.php (1 issue)

Labels
Severity
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\DateTimes;
13
14
use DateTime;
15
use Throwable;
16
use WBW\Bundle\JQuery\DataTablesBundle\Tests\AbstractTestCase;
17
use WBW\Bundle\JQuery\DataTablesBundle\Tests\Fixtures\Renderer\DateTimes\TestDateRendererTrait;
18
19
/**
20
 * Date renderer trait test.
21
 *
22
 * @author webeweb <https://github.com/webeweb>
23
 * @package WBW\Bundle\JQuery\DataTablesBundle\Tests\Renderer\DateTimes
24
 */
25
class DateRendererTraitTest extends AbstractTestCase {
26
27
    /**
28
     * Test renderDate()
29
     *
30
     * @return void
31
     * @throws Throwable Throws an exception if an error occurs.
32
     */
33
    public function testRenderDate(): void {
34
35
        $obj = new TestDateRendererTrait();
36
37
        $this->assertEquals("", $obj->renderDate(null));
0 ignored issues
show
Are you sure the usage of $obj->renderDate(null) targeting WBW\Bundle\JQuery\DataTa...ererTrait::renderDate() 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...
38
        $this->assertEquals("2019-01-14", $obj->renderDate(new DateTime("2019-01-14")));
39
        $this->assertEquals("14/01/2019", $obj->renderDate(new DateTime("2019-01-14"), "d/m/Y"));
40
    }
41
}
42