cakephp2-php8/tests/libs/dbo_factory_test.php
pies 4a87a75332 - Two standard controllers -- PageController and TestsController
- Helpers for controllers -- each controller has it's own helper in the /app/helpers directory
- /logs and /modules directories
- The application runs just fine without /config/database.php if controllers don't ask for db access
- Changed the name of /public/dispatch.php to /public/index.php, it's nicer and more standard, won't you agree? Kamil's fix for no-mod_rewrite needs to be re-implemented
- Cleanups, fixes, and even one or two comments ;)

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@158 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-05-22 23:24:09 +00:00

59 lines
No EOL
1.4 KiB
PHP

<?php
uses ('test', 'dbo_factory');
class DboFactoryTest extends TestCase {
var $abc;
// constructor of the test suite
function DboFactoryTest($name) {
$this->TestCase($name);
}
// called before the test functions will be executed
// this function is defined in PHPUnit_TestCase and overwritten
// here
function setUp() {
$this->abc = new DboFactory ();
}
// called after the test functions are executed
// this function is defined in PHPUnit_TestCase and overwritten
// here
function tearDown() {
unset($this->abc);
}
function testMake () {
if (class_exists(DATABASE_CONFIG)) {
$output = $this->abc->make('test');
$this->assertTrue(is_object($output));
$config = DATABASE_CONFIG::test();
if (preg_match('#^(adodb)_.*$#i', $config['driver'], $res)) {
$desired_driver_name = $res[1];
}
else
$desired_driver_name = $config['driver'];
$desired_class_name = 'dbo_'.strtolower($desired_driver_name);
$output_class_name = is_object($output)? get_class($output): false;
$this->assertEquals($output_class_name, $desired_class_name);
$this->assertTrue($output->connected);
}
}
// this test expect an E_USER_ERROR to occur during it's run
// I've disabled it until I find a way to assert it happen
//
// function testBadConfig () {
// $output = $this->abc->make(null);
// $this->assertTrue($output === false);
// }
}
?>