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

FluentSiteStateTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 30
rs 10
c 3
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testAppliesTo() 0 5 1
A testCurrentState() 0 7 1
A testDefaultState() 0 5 1
A testIsApplicable() 0 5 1
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