for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the jquery-datatables-bundle package.
*
* (c) 2021 WEBEWEB
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WBW\Bundle\JQuery\DataTablesBundle\Tests\Renderer\DateTimes;
use DateTime;
use Throwable;
use WBW\Bundle\JQuery\DataTablesBundle\Tests\AbstractTestCase;
use WBW\Bundle\JQuery\DataTablesBundle\Tests\Fixtures\Renderer\DateTimes\TestDateTimeRendererTrait;
/**
* Date/time renderer trait test.
* @author webeweb <https://github.com/webeweb>
* @package WBW\Bundle\JQuery\DataTablesBundle\Tests\Renderer\DateTimes
class DateTimeRendererTraitTest extends AbstractTestCase {
* Test renderDateTime()
* @return void
* @throws Throwable Throws an exception if an error occurs.
public function testRenderDateTime(): void {
$obj = new TestDateTimeRendererTrait();
$this->assertEquals("", $obj->renderDateTime(null));
$obj->renderDateTime(null)
WBW\Bundle\JQuery\DataTa...Trait::renderDateTime()
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.
getObject()
The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.
$this->assertEquals("2019-01-14 18:15", $obj->renderDateTime(new DateTime("2019-01-14 18:15:00")));
$this->assertEquals("14/01/2019 18h15", $obj->renderDateTime(new DateTime("2019-01-14 18:15:00"), "d/m/Y H\hi"));
}
This check looks for function or method calls that always return null and whose return value is used.
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.