1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | |||
0 ignored issues
–
show
|
|||
3 | use Ifsnop\Mysqldump\Mysqldump; |
||
4 | |||
5 | class MysqldumpTest extends PHPUnit_Framework_TestCase |
||
0 ignored issues
–
show
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.
You can fix this by adding a namespace to your class: namespace YourVendor;
class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries. ![]() |
|||
6 | { |
||
0 ignored issues
–
show
|
|||
7 | |||
8 | /** @test */ |
||
0 ignored issues
–
show
|
|||
9 | public function tableSpecificWhereConditionsWork() |
||
0 ignored issues
–
show
|
|||
10 | { |
||
0 ignored issues
–
show
|
|||
11 | $dump = new Mysqldump('mysql:host=localhost;dbname=test', 'testing', 'testing', array( |
||
0 ignored issues
–
show
|
|||
12 | 'where' => 'defaultWhere' |
||
0 ignored issues
–
show
|
|||
13 | )); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
14 | |||
15 | $dump->setTableWheres(array( |
||
0 ignored issues
–
show
|
|||
16 | 'users' => 'date_registered > NOW() - INTERVAL 3 MONTH AND is_deleted=0', |
||
0 ignored issues
–
show
|
|||
17 | 'logs' => 'date_registered > NOW() - INTERVAL 1 DAY', |
||
0 ignored issues
–
show
|
|||
18 | 'posts' => 'active=1' |
||
0 ignored issues
–
show
|
|||
19 | )); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
20 | |||
21 | $this->assertEquals( |
||
22 | 'date_registered > NOW() - INTERVAL 3 MONTH AND is_deleted=0', |
||
23 | $dump->getTableWhere('users') |
||
24 | ); |
||
25 | |||
26 | $this->assertEquals( |
||
27 | 'defaultWhere', |
||
28 | $dump->getTableWhere('non_overriden_table') |
||
29 | ); |
||
30 | } |
||
0 ignored issues
–
show
|
|||
31 | |||
32 | /** @test */ |
||
0 ignored issues
–
show
|
|||
33 | public function tableSpecificLimitsWork() |
||
34 | { |
||
0 ignored issues
–
show
|
|||
35 | $dump = new Mysqldump('mysql:host=localhost;dbname=test', 'testing', 'testing'); |
||
36 | |||
37 | $dump->setTableLimits(array( |
||
0 ignored issues
–
show
|
|||
38 | 'users' => 200, |
||
0 ignored issues
–
show
|
|||
39 | 'logs' => 500, |
||
0 ignored issues
–
show
|
|||
40 | 'table_with_invalid_limit' => '41923, 42992' |
||
0 ignored issues
–
show
|
|||
41 | )); |
||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||
42 | |||
43 | $this->assertEquals(200, $dump->getTableLimit('users')); |
||
44 | $this->assertEquals(500, $dump->getTableLimit('logs')); |
||
45 | $this->assertFalse($dump->getTableLimit('table_with_invalid_limit')); |
||
46 | $this->assertFalse($dump->getTableLimit('table_name_with_no_limit')); |
||
47 | } |
||
0 ignored issues
–
show
|
|||
48 | } |
||
0 ignored issues
–
show
|
|||
49 |