Passed
Push — master ( f996b3...a29f24 )
by Simon
01:59
created

FluentSiteStateTest::testCurrentState()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 7
rs 10
c 1
b 0
f 0
1
<?php
2
3
4
namespace Firesphere\SolrFluent\Tests;
5
6
use Firesphere\SolrFluent\States\FluentSiteState;
7
use SilverStripe\CMS\Model\SiteTree;
8
use SilverStripe\Dev\SapphireTest;
9
10
class FluentSiteStateTest extends SapphireTest
11
{
12
    public function testAppliesTo()
13
    {
14
        $state = new FluentSiteState();
15
16
        $this->assertFalse($state->appliesTo(SiteTree::class));
17
    }
18
19
    public function testIsApplicable()
20
    {
21
        $state = new FluentSiteState();
22
23
        $this->assertFalse($state->stateIsApplicable('en_US'));
24
    }
25
26
    public function testCurrentState()
27
    {
28
        $state = new FluentSiteState();
29
30
        $this->assertNull($state->activateState('en_US'));
1 ignored issue
show
Bug introduced by
Are you sure the usage of $state->activateState('en_US') targeting Firesphere\SolrFluent\St...eState::activateState() 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...
31
32
        $this->assertEquals('en_US', $state->currentState());
33
    }
34
35
    public function testDefaultState()
36
    {
37
        $state = new FluentSiteState();
38
39
        $this->assertNull($state->setDefaultState('en_US'));
1 ignored issue
show
Bug introduced by
Are you sure the usage of $state->setDefaultState('en_US') targeting Firesphere\SolrFluent\St...tate::setDefaultState() 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...
40
    }
41
}
42