For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 10 and the first side effect is on line 3.
The PSR-1: Basic Coding Standard recommends that a file should either introduce
new symbols, that is classes, functions, constants or similar, or have side effects.
Side effects are anything that executes logic, like for example printing output,
changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state
of an application. It also promotes a cleaner style of programming and makes your code
less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the
PSR-1.
Loading history...
2
namespace Mcknubb\Log;
3
include_once "CLogController.php";
4
include_once "TLog.php";
5
include_once "CLog.php";
6
/**
7
* HTML Form elements.
8
*
9
*/
10
class CLogControllerTest extends \PHPUnit_Framework_TestCase
11
{
12
/**
13
* Test that the Timestamp method saves the values correctly
14
*
15
* @return void
16
*
17
*/
18
public function testTimestamp()
19
{
20
21
$Clog = new \Mcknubb\Log\CLogController();
22
23
$class = 'testClass';
24
$method = 'testMethod';
25
$comment = 'testComment';
26
$Clog->Timestamp($class, $method, $comment);
27
$res = $Clog->getTimestampsAsArray();
28
$resClass = $res[0]['domain'];
29
$this->assertEquals($resClass, $class, "The registered class doesn't match the result");
30
$resMethod = $res[0]['where'];
31
$this->assertEquals($resMethod, $method, "The registerde method doesn't match the result");
32
$resComment = $res[0]['comment'];
33
$this->assertEquals($resComment, $comment, "The registered comment doesn't match the result");
34
}
35
/**
36
* Test that we always get a stirng as return value
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.