Issues (117)

Tests/Renderer/Floats/FloatRendererTraitTest.php (3 issues)

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\Floats;
13
14
use WBW\Bundle\JQuery\DataTablesBundle\Tests\AbstractTestCase;
15
use WBW\Bundle\JQuery\DataTablesBundle\Tests\Fixtures\Renderer\Floats\TestFloatRendererTrait;
16
17
/**
18
 * Float renderer trait test.
19
 *
20
 * @author webeweb <https://github.com/webeweb>
21
 * @package WBW\Bundle\JQuery\DataTablesBundle\Tests\Renderer\Floats
22
 */
23
class FloatRendererTraitTest extends AbstractTestCase {
24
25
    /**
26
     * Test the renderFloat() methods.
27
     *
28
     * @return void
29
     */
30
    public function testRenderFloat(): void {
31
32
        $obj = new TestFloatRendererTrait();
33
34
        $this->assertEquals("", $obj->renderFloat(null));
0 ignored issues
show
Are you sure the usage of $obj->renderFloat(null) targeting WBW\Bundle\JQuery\DataTa...rerTrait::renderFloat() 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("1,000.00", $obj->renderFloat(1000));
36
        $this->assertEquals("1,000.000", $obj->renderFloat(1000, 3));
37
        $this->assertEquals("1 000,000", $obj->renderFloat(1000, 3, ",", " "));
38
    }
39
40
    /**
41
     * Test the renderPercent() methods.
42
     *
43
     * @return void
44
     */
45
    public function testRenderPercent(): void {
46
47
        $obj = new TestFloatRendererTrait();
48
49
        $this->assertNull($obj->renderPercent(null));
0 ignored issues
show
Are you sure the usage of $obj->renderPercent(null) targeting WBW\Bundle\JQuery\DataTa...rTrait::renderPercent() 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...
50
        $this->assertEquals("100.00 %", $obj->renderPercent(100));
51
    }
52
53
    /**
54
     * Test the renderPrice() methods.
55
     *
56
     * @return void
57
     */
58
    public function testRenderPrice(): void {
59
60
        $obj = new TestFloatRendererTrait();
61
62
        $this->assertNull($obj->renderPrice(null));
0 ignored issues
show
Are you sure the usage of $obj->renderPrice(null) targeting WBW\Bundle\JQuery\DataTa...rerTrait::renderPrice() 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...
63
        $this->assertEquals("1,000.00 €", $obj->renderPrice(1000));
64
        $this->assertEquals("1,000.00 $", $obj->renderPrice(1000, "$"));
65
    }
66
}
67