Hey guys, I'm trying to run some PHPUnit tests locally on my model
classes, against a local test database.  I'm using the following simple
test-running script to set up the db connection and then run tests:


<?php
set_include_path(
        realpath('../../../library') . PATH_SEPARATOR .
        realpath('../')              . PATH_SEPARATOR .
        get_include_path());

require_once 'Zend/Db.php';
require_once 'Zend/Db/Table.php';

$db = Zend_DB::factory('PDO_MYSQL', array(
        'host'     => 'localhost',
        'username' => 'root',
        'password' => 'ingirum68',
        'dbname'   => 'vzwprint'));
$db->query("SET NAMES 'utf8'");
Zend_Db_Table::setDefaultAdapter($db);

$tests = explode(',', $_GET['tests']);
foreach ($tests as $class) require_once "$class.php";

require_once 'PHPUnit/TextUI/TestRunner.php';
$suite = new PHPUnit_Framework_TestSuite();
foreach ($tests as $class) $suite->addTestSuite($class);
echo '<pre>';
PHPUnit_TextUI_TestRunner::run($suite);


Pretty straightforward... right now I'm just pointing it at an empty
TestCase class just to see if the basic setup is working, and here's what
I'm getting for output:


PHPUnit 3.2.9 by Sebastian Bergmann.

E

Time: 0 seconds

There was 1 error:

1) Warning(PHPUnit_Framework_Warning)
PDOException: You cannot serialize or unserialize PDO instances
C:\workspace\vzwprint\application\default\tests\run-tests.php:25

FAILURES!
Tests: 1, Errors: 1.


Yeah, so thanks PHPUnit and/or PDO and/or ZF, but I never /asked/ to
serialize any PDO instances, so if you would mind just not doing that,
that would be great.

I'm not even loading up any of my own model code at this point.  Anyone
got some idea what the hell is going on here?

Reply via email to