MysqldumpTest::tableSpecificWhereConditionsWork()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 12
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 20
rs 9.8666
1
<?php
0 ignored issues
show
Coding Style introduced by
This file is missing a doc comment.
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
Coding Style introduced by
Filename "MysqldumpTest.php" doesn't match the expected filename "mysqldumptest.php"
Loading history...
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
use Ifsnop\Mysqldump\Mysqldump;
4
5
class MysqldumpTest extends PHPUnit_Framework_TestCase
0 ignored issues
show
Coding Style Documentation introduced by
Missing class doc comment
Loading history...
Coding Style Compatibility introduced by
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.

Loading history...
6
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for class MysqldumpTest
Loading history...
7
8
    /** @test */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing @return tag in function comment
Loading history...
9
    public function tableSpecificWhereConditionsWork()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
10
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
11
        $dump = new Mysqldump('mysql:host=localhost;dbname=test', 'testing', 'testing', array(
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Short array syntax must be used to define arrays
Loading history...
12
            'where' => 'defaultWhere'
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 89 spaces, but found 12.
Loading history...
13
        ));
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 88 space(s), but found 8.
Loading history...
Coding Style introduced by
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.
Loading history...
14
15
        $dump->setTableWheres(array(
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Short array syntax must be used to define arrays
Loading history...
16
            'users' => 'date_registered > NOW() - INTERVAL 3 MONTH AND is_deleted=0',
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 31 spaces, but found 12.
Loading history...
17
            'logs' => 'date_registered > NOW() - INTERVAL 1 DAY',
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 31 spaces, but found 12.
Loading history...
18
            'posts' => 'active=1'
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 31 spaces, but found 12.
Loading history...
19
        ));
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 30 space(s), but found 8.
Loading history...
Coding Style introduced by
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.
Loading history...
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
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end tableSpecificWhereConditionsWork()
Loading history...
31
32
    /** @test */
0 ignored issues
show
Coding Style introduced by
The open comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
The close comment tag must be the only content on the line
Loading history...
Coding Style introduced by
Missing @return tag in function comment
Loading history...
33
    public function tableSpecificLimitsWork()
34
    {
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration
Loading history...
35
        $dump = new Mysqldump('mysql:host=localhost;dbname=test', 'testing', 'testing');
36
37
        $dump->setTableLimits(array(
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
Short array syntax must be used to define arrays
Loading history...
38
            'users' => 200,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 31 spaces, but found 12.
Loading history...
39
            'logs' => 500,
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 31 spaces, but found 12.
Loading history...
40
            'table_with_invalid_limit' => '41923, 42992'
0 ignored issues
show
Coding Style introduced by
This array key does not seem to be aligned correctly; expected 31 spaces, but found 12.
Loading history...
41
        ));
0 ignored issues
show
Coding Style introduced by
The closing parenthesis does not seem to be aligned correctly; expected 30 space(s), but found 8.
Loading history...
Coding Style introduced by
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.
Loading history...
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
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end tableSpecificLimitsWork()
Loading history...
48
}
0 ignored issues
show
Coding Style introduced by
Expected //end class
Loading history...
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
49