mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +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
95 lines
No EOL
3.4 KiB
PHP
95 lines
No EOL
3.4 KiB
PHP
<?php
|
|
// $Id$
|
|
|
|
require_once(dirname(__FILE__) . '/../options.php');
|
|
|
|
class TestOfOptions extends UnitTestCase {
|
|
|
|
function testMockBase() {
|
|
$old_class = SimpleTestOptions::getMockBaseClass();
|
|
SimpleTestOptions::setMockBaseClass('Fred');
|
|
$this->assertEqual(SimpleTestOptions::getMockBaseClass(), 'Fred');
|
|
SimpleTestOptions::setMockBaseClass($old_class);
|
|
}
|
|
|
|
function testStubBase() {
|
|
$old_class = SimpleTestOptions::getStubBaseClass();
|
|
SimpleTestOptions::setStubBaseClass('Fred');
|
|
$this->assertEqual(SimpleTestOptions::getStubBaseClass(), 'Fred');
|
|
SimpleTestOptions::setStubBaseClass($old_class);
|
|
}
|
|
|
|
function testIgnoreList() {
|
|
$this->assertFalse(SimpleTestOptions::isIgnored('ImaginaryTestCase'));
|
|
SimpleTestOptions::ignore('ImaginaryTestCase');
|
|
$this->assertTrue(SimpleTestOptions::isIgnored('ImaginaryTestCase'));
|
|
}
|
|
}
|
|
|
|
class ComparisonClass {
|
|
}
|
|
|
|
class ComparisonSubclass extends ComparisonClass {
|
|
}
|
|
|
|
class TestOfCompatibility extends UnitTestCase {
|
|
|
|
function testIsA() {
|
|
$this->assertTrue(SimpleTestCompatibility::isA(
|
|
new ComparisonClass(),
|
|
'ComparisonClass'));
|
|
$this->assertFalse(SimpleTestCompatibility::isA(
|
|
new ComparisonClass(),
|
|
'ComparisonSubclass'));
|
|
$this->assertTrue(SimpleTestCompatibility::isA(
|
|
new ComparisonSubclass(),
|
|
'ComparisonClass'));
|
|
}
|
|
|
|
function testIdentityOfObjects() {
|
|
$object1 = new ComparisonClass();
|
|
$object2 = new ComparisonClass();
|
|
$this->assertIdentical($object1, $object2);
|
|
}
|
|
|
|
function testReferences () {
|
|
$thing = "Hello";
|
|
$thing_reference = &$thing;
|
|
$thing_copy = $thing;
|
|
$this->assertTrue(SimpleTestCompatibility::isReference(
|
|
$thing,
|
|
$thing));
|
|
$this->assertTrue(SimpleTestCompatibility::isReference(
|
|
$thing,
|
|
$thing_reference));
|
|
$this->assertFalse(SimpleTestCompatibility::isReference(
|
|
$thing,
|
|
$thing_copy));
|
|
}
|
|
|
|
function testObjectReferences () {
|
|
$object = &new ComparisonClass();
|
|
$object_reference = &$object;
|
|
$object_copy = new ComparisonClass();
|
|
$object_assignment = $object;
|
|
$this->assertTrue(SimpleTestCompatibility::isReference(
|
|
$object,
|
|
$object));
|
|
$this->assertTrue(SimpleTestCompatibility::isReference(
|
|
$object,
|
|
$object_reference));
|
|
$this->assertFalse(SimpleTestCompatibility::isReference(
|
|
$object,
|
|
$object_copy));
|
|
if (version_compare(phpversion(), '5', '>=')) {
|
|
$this->assertTrue(SimpleTestCompatibility::isReference(
|
|
$object,
|
|
$object_assignment));
|
|
} else {
|
|
$this->assertFalse(SimpleTestCompatibility::isReference(
|
|
$object,
|
|
$object_assignment));
|
|
}
|
|
}
|
|
}
|
|
?>
|