tests/App/Request.php
Avoid using static access to class '\App\Request' in method 'testConstruct'. Open
Open
$this->assertInstanceOf('\App\Request', \App\Request::init());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Call to undeclared method \Tests\App\Request::assertInstanceOf
Open
Open
$this->assertInstanceOf('\App\Request', \App\Request::init());
- Exclude checks
Call to undeclared method \Tests\App\Request::assertIsArray
Open
Open
$this->assertIsArray(\App\Request::init()->getAllRaw());
- Exclude checks
Call to undeclared method \Tests\App\Request::assertEmpty
Open
Open
$this->assertEmpty(\App\Request::init()->getHeaders(), 'In CLI mode should not return any headers');
- Exclude checks
Call to undeclared method \Tests\App\Request::assertIsArray
Open
Open
$this->assertIsArray(\App\Request::init()->getAll());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Testing getHeaders method.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->assertEmpty(\App\Request::init()->getHeaders(), 'In CLI mode should not return any headers');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Testing object construction.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function testGetHeaders()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function testConstruct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function testGetAll()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->assertIsArray(\App\Request::init()->getAllRaw());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->assertInstanceOf('\App\Request', \App\Request::init());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
* Testing getAll function.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->assertIsArray(\App\Request::init()->getAll());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks