From 492dd25c5ad36de404b0e68f3c1ccec2d68bc379 Mon Sep 17 00:00:00 2001 From: alban Date: Thu, 27 Mar 2014 10:20:26 +0100 Subject: [PATCH] [fix] unit tests composite datasets --- phpunit/lib/AlterncTest.php | 18 +++++++++++++----- phpunit/tests/_datasets/domaines.yml | 18 +++++++++--------- phpunit/tests/bureau/class/m_mailTest.php | 1 - 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/phpunit/lib/AlterncTest.php b/phpunit/lib/AlterncTest.php index 421aa4ae..36faa47c 100644 --- a/phpunit/lib/AlterncTest.php +++ b/phpunit/lib/AlterncTest.php @@ -21,13 +21,21 @@ abstract class AlterncTest extends PHPUnit_Extensions_Database_TestCase * @return \PHPUnit_Extensions_Database_DataSet_YamlDataSet * @throws \Exception */ - public function loadDataSet($file_name) + public function loadDataSet($fileList) { - $file = PHPUNIT_DATASETS_PATH."/$file_name"; - if( !is_file($file) ){ - throw new \Exception("missing $file"); + if( !is_array($fileList)){ + $fileList = array($fileList); } - $dataSet = new PHPUnit_Extensions_Database_DataSet_YamlDataSet($file); + $datasetList = array(); + foreach ($fileList as $file_name) { + $file = PHPUNIT_DATASETS_PATH."/$file_name"; + if( !is_file($file) ){ + throw new \Exception("missing $file"); + } + $dataSet = new PHPUnit_Extensions_Database_DataSet_YamlDataSet($file); + $datasetList[] = $dataSet; + } + $compositeDataSet = new PHPUnit_Extensions_Database_DataSet_CompositeDataSet($datasetList); return $dataSet; } diff --git a/phpunit/tests/_datasets/domaines.yml b/phpunit/tests/_datasets/domaines.yml index a3f60c96..17399e98 100644 --- a/phpunit/tests/_datasets/domaines.yml +++ b/phpunit/tests/_datasets/domaines.yml @@ -1,11 +1,11 @@ domaines: - - id : 1 - compte : 2001 - domaine : example.tld - gesdns : 1 - gesmx : 1 - noerase : 0 - dns_action : OK - dns_result : 0 - zonettl : 86400 + id : 1 + compte : 2001 + domaine : example.tld + gesdns : 1 + gesmx : 1 + noerase : 0 + dns_action : OK + dns_result : 0 + zonettl : 86400 diff --git a/phpunit/tests/bureau/class/m_mailTest.php b/phpunit/tests/bureau/class/m_mailTest.php index 258f177e..abc11a81 100644 --- a/phpunit/tests/bureau/class/m_mailTest.php +++ b/phpunit/tests/bureau/class/m_mailTest.php @@ -320,7 +320,6 @@ class m_mailTest extends AlterncTest public function testCreate_alias() { // Test #1580 - $this->object-> } /**