GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( da7651...84ea09 )
by Leandro
03:32
created

DomainServiceTest::testConfigFiles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace LosDomainTest;
3
4
use LosDomain\DomainService;
5
use PHPUnit\Framework\TestCase;
6
7
class DomainServiceTest extends TestCase
8
{
9
    public function testEmptyConfigFiles()
10
    {
11
        $this->assertEmpty(DomainService::configFiles(__DIR__.'/missing_assets'));
12
    }
13
14
    public function testConfigFiles()
15
    {
16
        $this->assertCount(2, DomainService::configFiles(__DIR__.'/assets'));
17
    }
18
19
    public function testConfigFilesFromAlias()
1 ignored issue
show
Coding Style introduced by
testConfigFilesFromAlias uses the super-global variable $_SERVER which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
20
    {
21
        $_SERVER['HTTP_HOST'] = 'localhost';
22
        $this->assertCount(2, DomainService::configFiles(__DIR__.'/assets'));
23
    }
24
}
25