Hi, i'm having some problems trying to run my unit tests on Zend Studio 8
with phpunit and zf 1.11.
The test is just a simple assertion to confirm the environment is set up
correctly, but i am getting the following error:
/
ZendPHPUnitUserErrorException: Argument 1 passed to
PHPUnit_Extensions_Database_Dataset_DefaultTableIterator::__construct() must
be an array, null given, called in [path to zend studio plugin]
(then in the trace failure, underneath the above line:)
PHPUnit_Extensions_Database_Dataset_AbstractDataSet->getReverseIterator()
/
I am fairly sure my set up is correct.
My test bootstrap:
/error_reporting(E_ALL | E_STRICT);
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) .
'/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ?
getenv('APPLICATION_ENV') : 'testing'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
require_once 'Zend/Application.php';
/
and my test case, with a simple true assertion:
/ class UserMapperTest extends Zend_Test_PHPUnit_DatabaseTestCase
{
/**
*
* @var PHPUnit_Extensions_Database_DB_IDatabaseConnection
*/
protected $_connection;
public function testFoo(){
$this->assertTrue(true);
}
/**
* Returns the test database connection.
*
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
*/
protected function getConnection(){
if (empty($this->_connection)) {
$app = new Zend_Application(APPLICATION_ENV,
APPLICATION_PATH .
'/configs/application.ini');
$app->bootstrap();
$options = $app->getOptions();
$schema = $options['resources']['db']['params']['dbname'];
$db = $app->getBootstrap()->getPluginResource('db');
$dbAdapter = $db->getDbAdapter();
$this->_connection =
$this->createZendDbConnection($dbAdapter,
$schema);
}
return $this->_connection;
}
/**
* @return PHPUnit_Extensions_Database_DataSet_IDataSet
*/
protected function getDataSet(){
return $this->createXmlDataSet(dirname(__FILE__) .
DIRECTORY_SEPARATOR
. 'fixtures' . DIRECTORY_SEPARATOR
. 'seed.xml');
}
}
/
What am i doing wrong?
--
View this message in context:
http://zend-framework-community.634137.n4.nabble.com/unit-testing-db-exception-PHPUnit-Extensions-Database-Dataset-DefaultTableIterator-tp4657823.html
Sent from the Zend Framework mailing list archive at Nabble.com.
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]