HasContentTraitTest::test_hasContent()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace ByTIC\Assets\Tests\Assets\Asset\Traits;
4
5
use ByTIC\Assets\Assets\Asset;
6
use ByTIC\Assets\Tests\AbstractTest;
7
8
/**
9
 * Class HasContentTraitTest
10
 * @package ByTIC\Assets\Tests\Assets\Asset\Traits
11
 */
12
class HasContentTraitTest extends AbstractTest
13
{
14
    public function test_hasContent()
15
    {
16
        $asset = new Asset('', Asset::TYPE_STYLES);
17
        self::assertFalse($asset->hasContent());
18
        $asset->setContent('++');
19
        self::assertTrue($asset->hasContent());
20
    }
21
22
    public function test_appendContent()
23
    {
24
        $asset = new Asset('', Asset::TYPE_STYLES);
25
        self::assertEmpty($asset->getContent());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $asset->getContent() targeting ByTIC\Assets\Assets\Asset::getContent() 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...
26
27
        $asset->appendContent('1');
28
        self::assertSame('1', $asset->getContent());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $asset->getContent() targeting ByTIC\Assets\Assets\Asset::getContent() 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...
29
30
        $asset->appendContent('2');
31
        self::assertSame('1'."\r\n".'2', $asset->getContent());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $asset->getContent() targeting ByTIC\Assets\Assets\Asset::getContent() 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...
32
    }
33
34
    public function test_prependContent()
35
    {
36
        $asset = new Asset('', Asset::TYPE_STYLES);
37
        self::assertEmpty($asset->getContent());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $asset->getContent() targeting ByTIC\Assets\Assets\Asset::getContent() 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
39
        $asset->prependContent('1');
40
        self::assertSame('1', $asset->getContent());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $asset->getContent() targeting ByTIC\Assets\Assets\Asset::getContent() 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...
41
42
        $asset->prependContent('2');
43
        self::assertSame('2'."\r\n".'1', $asset->getContent());
0 ignored issues
show
Bug introduced by
Are you sure the usage of $asset->getContent() targeting ByTIC\Assets\Assets\Asset::getContent() 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...
44
    }
45
}
46