-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace PhpPlatform\Tests\PersistUnit; | ||
|
||
class DBInsert extends \PHPUnit_Extensions_Database_Operation_Insert{ | ||
|
||
/** | ||
* @param PHPUnit_Extensions_Database_DB_IDatabaseConnection $connection | ||
* @param DataSet $dataSet | ||
*/ | ||
public function execute(\PHPUnit_Extensions_Database_DB_IDatabaseConnection $connection,\PHPUnit_Extensions_Database_DataSet_IDataSet $dataSet) | ||
{ | ||
$connection->getConnection()->query("SET foreign_key_checks = 0"); | ||
|
||
// execute the data files first | ||
$dataFiles = $dataSet->getDataFiles(); | ||
foreach ($dataFiles as $dataFile){ | ||
$dataFileContent = file_get_contents($dataFile); | ||
$connection->getConnection()->exec($dataFileContent); | ||
} | ||
|
||
// execute data set | ||
parent::execute($connection, $dataSet); | ||
$connection->getConnection()->query("SET foreign_key_checks = 1"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace PhpPlatform\Tests\PersistUnit; | ||
|
||
class DataSet extends \PHPUnit_Extensions_Database_DataSet_MysqlXmlDataSet{ | ||
|
||
private $datafiles = array(); | ||
|
||
function __construct($datafiles,$xmlFile){ | ||
$this->datafiles = $datafiles; | ||
parent::__construct($xmlFile); | ||
} | ||
|
||
function getDataFiles(){ | ||
return $this->datafiles; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters