mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
da79dff7d7
- Dispatcher sets a Controller::here variable with the real URL used to access the page, so that tag generators can that use an url (linkTo and formTag for example) use the real url, not guess it from the controller and action names which often fails - Log class works more reliably and a LogError() shortcut function was added - Nstring class added, to store string-related functions (there are just four yet, including a random password generator and an string-to-array splitter - SimpleTest library (with Rephlux) included in /vendors; I've tweaked SimpleScorer::inCli() function, because it didn't work on my setup, it should work everywhere now (it checks for empty REQUEST_METHOD, which should only be empty in CLI) git-svn-id: https://svn.cakephp.org/repo/trunk/cake@248 3807eeeb-6ff5-0310-8944-8be069107fe0
68 lines
No EOL
1.5 KiB
PHP
68 lines
No EOL
1.5 KiB
PHP
<?php
|
|
|
|
uses('dbo_factory');
|
|
|
|
class DboFactoryTest extends UnitTestCase
|
|
{
|
|
var $dboFactory;
|
|
|
|
// constructor of the test suite
|
|
function DboFactoryTest()
|
|
{
|
|
$this->UnitTestCase('DBO Factory test');
|
|
}
|
|
|
|
// called before the test functions will be executed
|
|
// this function is defined in PHPUnit_TestCase and overwritten
|
|
// here
|
|
function setUp()
|
|
{
|
|
$this->dboFactory = new DboFactory();
|
|
}
|
|
|
|
// called after the test functions are executed
|
|
// this function is defined in PHPUnit_TestCase and overwritten
|
|
// here
|
|
function tearDown()
|
|
{
|
|
unset($this->dboFactory);
|
|
}
|
|
|
|
|
|
function testMake()
|
|
{
|
|
if(class_exists('DATABASE_CONFIG'))
|
|
{
|
|
|
|
$output = $this->dboFactory->make('test');
|
|
$this->assertTrue(is_object($output), 'We create dbo factory object');
|
|
|
|
$config = DATABASE_CONFIG::test();
|
|
if(preg_match('#^(adodb)_.*$#i', $config['driver'], $res))
|
|
{
|
|
$desiredDriverName = $res[1];
|
|
}
|
|
else
|
|
{
|
|
$desiredDriverName = $config['driver'];
|
|
}
|
|
|
|
$desiredClassName = 'dbo_'.strtolower($desiredDriverName);
|
|
$outputClassName = is_object($output)? strtolower(get_class($output)): false;
|
|
|
|
$this->assertEqual($outputClassName, $desiredClassName, "Class name should be $desiredClassName - is $outputClassName");
|
|
|
|
$this->assertTrue($output->connected, 'We are 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->dboFactory->make(null);
|
|
// $this->assertTrue($output === false);
|
|
// }
|
|
}
|
|
|
|
?>
|