Commit e757ccc5 authored by jwage's avatar jwage

General dev on tests.

parent 838ccd68
...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) { ...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'AllTests::main'); define('PHPUnit_MAIN_METHOD', 'AllTests::main');
} }
require_once 'PHPUnit/Framework.php'; require_once 'lib/DoctrineTestInit.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'lib/Doctrine_TestSuite.php';
// Suites
require_once 'Dbal/AllTests.php'; require_once 'Dbal/AllTests.php';
require_once 'Orm/AllTests.php'; require_once 'Orm/AllTests.php';
require_once 'Ticket/AllTests.php'; require_once 'Ticket/AllTests.php';
...@@ -20,7 +19,7 @@ class AllTests ...@@ -20,7 +19,7 @@ class AllTests
public static function suite() public static function suite()
{ {
$suite = new Doctrine_TestSuite('Doctrine'); $suite = new Doctrine_TestSuite('Doctrine Tests');
$suite->addTest(Dbal_AllTests::suite()); $suite->addTest(Dbal_AllTests::suite());
$suite->addTest(Orm_AllTests::suite()); $suite->addTest(Orm_AllTests::suite());
......
...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) { ...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Dbal_AllTests::main'); define('PHPUnit_MAIN_METHOD', 'Dbal_AllTests::main');
} }
require_once 'PHPUnit/Framework.php'; require_once 'lib/DoctrineTestInit.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'lib/Doctrine_TestSuite.php';
// Suites
require_once 'Dbal/Component/AllTests.php'; require_once 'Dbal/Component/AllTests.php';
class Dbal_AllTests class Dbal_AllTests
......
...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) { ...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Dbal_Component_AllTests::main'); define('PHPUnit_MAIN_METHOD', 'Dbal_Component_AllTests::main');
} }
require_once 'PHPUnit/Framework.php'; require_once 'lib/DoctrineTestInit.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'lib/Doctrine_TestSuite.php';
// Tests
require_once 'Dbal/Component/TestTest.php'; require_once 'Dbal/Component/TestTest.php';
class Dbal_Component_AllTests class Dbal_Component_AllTests
......
<?php <?php
require_once 'lib/Doctrine_TestCase.php'; require_once 'lib/DoctrineTestInit.php';
class Dbal_Component_TestTest extends Doctrine_TestCase class Dbal_Component_TestTest extends Doctrine_TestCase
{ {
......
...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) { ...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Orm_AllTests::main'); define('PHPUnit_MAIN_METHOD', 'Orm_AllTests::main');
} }
require_once 'PHPUnit/Framework.php'; require_once 'lib/DoctrineTestInit.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'lib/Doctrine_TestSuite.php';
// Suites
require_once 'Orm/Component/AllTests.php'; require_once 'Orm/Component/AllTests.php';
class Orm_AllTests class Orm_AllTests
......
...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) { ...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Dbal_Component_AllTests::main'); define('PHPUnit_MAIN_METHOD', 'Dbal_Component_AllTests::main');
} }
require_once 'PHPUnit/Framework.php'; require_once 'lib/DoctrineTestInit.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'lib/Doctrine_TestSuite.php';
// Tests
require_once 'Orm/Component/TestTest.php'; require_once 'Orm/Component/TestTest.php';
class Orm_Component_AllTests class Orm_Component_AllTests
......
<?php <?php
require_once 'lib/Doctrine_TestCase.php'; require_once 'lib/DoctrineTestInit.php';
class Orm_Component_TestTest extends Doctrine_TestCase class Orm_Component_TestTest extends Doctrine_TestCase
{ {
......
<?php <?php
require_once 'lib/Doctrine_TestCase.php'; require_once 'lib/DoctrineTestInit.php';
class Ticket_1Test extends Doctrine_TestCase class Ticket_1Test extends Doctrine_TestCase
{ {
......
...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) { ...@@ -3,10 +3,9 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
define('PHPUnit_MAIN_METHOD', 'Ticket_AllTests::main'); define('PHPUnit_MAIN_METHOD', 'Ticket_AllTests::main');
} }
require_once 'PHPUnit/Framework.php'; require_once 'lib/DoctrineTestInit.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'lib/Doctrine_TestSuite.php';
// Tests
require_once 'Ticket/1Test.php'; require_once 'Ticket/1Test.php';
class Ticket_AllTests class Ticket_AllTests
......
---
CmsUser:
CmsUser_1:
username: jwage
password: changeme
\ No newline at end of file
<?php
class CmsUser extends Doctrine_Record
{
public static function initMetadata($class)
{
$class->setColumn('id', 'integer', 4, array('primary' => true, 'autoincrement' => true));
$class->setColumn('username', 'string', 255);
$class->setColumn('username', 'string', 255);
}
}
\ No newline at end of file
<?php
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'Doctrine_TestCase.php';
require_once 'Doctrine_TestSuite.php';
require_once '../lib/Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));
\ No newline at end of file
<?php <?php
require_once 'PHPUnit/Framework.php';
class Doctrine_TestCase extends PHPUnit_Framework_TestCase class Doctrine_TestCase extends PHPUnit_Framework_TestCase
{ {
public function setUp()
{
$pdo = new PDO('sqlite::memory:');
$this->sharedFixture = $this->loadConnection($pdo, 'sqlite_memory');
}
public function loadConnection($conn, $name)
{
return Doctrine_Manager::connection($conn, $name);
}
public function loadFixturesPackage($package, $models = array())
{
$packagePath = 'fixtures' . DIRECTORY_SEPARATOR . $package;
if ( ! file_exists($packagePath)) {
throw new Exception('Could not find fixtures package: "' . $package . '"');
}
$modelsPath = $packagePath . DIRECTORY_SEPARATOR . 'models';
$dataPath = $packagePath . DIRECTORY_SEPARATOR . 'data';
Doctrine::loadModels($modelsPath);
Doctrine::createTablesFromModels($modelsPath);
$data = new Doctrine_Data();
$data->importData($dataPath, 'yml', $models);
}
public function tearDown()
{
Doctrine_Manager::getInstance()->getConnection('sqlite_memory')->close();
$this->sharedFixture = NULL;
}
} }
\ No newline at end of file
<?php <?php
require_once 'PHPUnit/Framework.php';
class Doctrine_TestSuite extends PHPUnit_Framework_TestSuite class Doctrine_TestSuite extends PHPUnit_Framework_TestSuite
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment