mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 22:40:39 +02:00
Merge remote-tracking branch 'upstream/develop' into ticket/11015
* upstream/develop: (196 commits) [ticket/11219] Coding guidelines and naming consistency changes [ticket/10841] Revert more whitespace changes. [ticket/10841] Revert whitespace changes. [ticket/10841] adding space after if [ticket/10841] removing unnecessary spacing [ticket/10841] changing affectedrows check to COUNT in sql [ticket/10841] Modifying style and language selectors in UCP [ticket/11247] Fix wrong property reference in flock class. [ticket/10602] Avoid a race condition. [ticket/10602] Use last_queue_run for its intended purpose. [ticket/10716] Collect standard error from executed php process. [ticket/10716] Skip test if php is not in PATH. [ticket/10716] Exclude our dependencies from linting. [ticket/10103] New and improved wording. [ticket/10716] Only lint on php 5.3+. [ticket/10103] Assert with messages. [ticket/10103] assertLessThan/assertGreaterThan. [ticket/10103] Inline assignment is bad? [ticket/10103] $rv had too few characters. [ticket/10103] Correct flock class documentation. ... Conflicts: phpBB/includes/functions.php tests/cache/cache_test.php
This commit is contained in:
@@ -13,6 +13,8 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
|
||||
protected $test_case_helpers;
|
||||
|
||||
protected $fixture_xml_data;
|
||||
|
||||
public function __construct($name = NULL, array $data = array(), $dataName = '')
|
||||
{
|
||||
parent::__construct($name, $data, $dataName);
|
||||
@@ -28,6 +30,20 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
);
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
// Resynchronise tables if a fixture was loaded
|
||||
if (isset($this->fixture_xml_data))
|
||||
{
|
||||
$config = $this->get_database_config();
|
||||
$manager = $this->create_connection_manager($config);
|
||||
$manager->connect();
|
||||
$manager->post_setup_synchronisation($this->fixture_xml_data);
|
||||
}
|
||||
}
|
||||
|
||||
public function createXMLDataSet($path)
|
||||
{
|
||||
$db_config = $this->get_database_config();
|
||||
@@ -47,7 +63,9 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
$path = $meta_data['uri'];
|
||||
}
|
||||
|
||||
return parent::createXMLDataSet($path);
|
||||
$this->fixture_xml_data = parent::createXMLDataSet($path);
|
||||
|
||||
return $this->fixture_xml_data;
|
||||
}
|
||||
|
||||
public function get_test_case_helpers()
|
||||
@@ -139,4 +157,20 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||
{
|
||||
return $matches[1] . strtoupper($matches[2]) . $matches[3];
|
||||
}
|
||||
|
||||
public function assert_array_content_equals($one, $two)
|
||||
{
|
||||
// http://stackoverflow.com/questions/3838288/phpunit-assert-two-arrays-are-equal-but-order-of-elements-not-important
|
||||
// but one array_diff is not enough!
|
||||
if (sizeof(array_diff($one, $two)) || sizeof(array_diff($two, $one)))
|
||||
{
|
||||
// get a nice error message
|
||||
$this->assertEquals($one, $two);
|
||||
}
|
||||
else
|
||||
{
|
||||
// increase assertion count
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user