for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use Ifsnop\Mysqldump\Mysqldump;
class MysqldumpTest extends PHPUnit_Framework_TestCase
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.
{
/** @test */
public function tableSpecificWhereConditionsWork()
$dump = new Mysqldump('mysql:host=localhost;dbname=test', 'testing', 'testing', array(
'where' => 'defaultWhere'
));
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.
$dump->setTableWheres(array(
'users' => 'date_registered > NOW() - INTERVAL 3 MONTH AND is_deleted=0',
'logs' => 'date_registered > NOW() - INTERVAL 1 DAY',
'posts' => 'active=1'
$this->assertEquals(
'date_registered > NOW() - INTERVAL 3 MONTH AND is_deleted=0',
$dump->getTableWhere('users')
);
'defaultWhere',
$dump->getTableWhere('non_overriden_table')
}
public function tableSpecificLimitsWork()
$dump = new Mysqldump('mysql:host=localhost;dbname=test', 'testing', 'testing');
$dump->setTableLimits(array(
'users' => 200,
'logs' => 500,
'table_with_invalid_limit' => '41923, 42992'
$this->assertEquals(200, $dump->getTableLimit('users'));
$this->assertEquals(500, $dump->getTableLimit('logs'));
$this->assertFalse($dump->getTableLimit('table_with_invalid_limit'));
$this->assertFalse($dump->getTableLimit('table_name_with_no_limit'));
This check marks files that end in a newline character, i.e. an empy line.