2 // vim: foldmethod=marker
4 * Ethna_ClassFactory_Test.php
6 * @author Yoshinari Takaoka <takaoka@beatcraft.com>
10 require_once ETHNA_BASE . '/test/Ethna_MocktestManager.php';
12 //{{{ Ethna_ClassFactory_Test
14 * Test Case For Ethna_ClassFactory_Test
18 class Ethna_ClassFactory_Test extends Ethna_UnitTestBase
24 $ctl =& new Ethna_Controller();
25 $this->cf =& $ctl->getClassFactory();
28 // Ethna_Controller と Ethna_ClassFactory は
29 // 循環参照している。PHP4では、循環参照しているオブジェクト同士を
30 // 比較しようとすると延々再帰的にプロパティと値を比較しようとする
31 // ため Fatal Error を起こす。よって、PHP5以降でのみ以下はテストする
32 // @see http://www.php.net/manual/en/language.oop.object-comparison.php
33 // @see http://www.php.net/manual/en/language.oop5.object-comparison.php
35 function test_getManager()
40 if (version_compare(phpversion(), '5', '>=')) {
41 $manager = $this->cf->getManager('mocktest');
42 $manager_alt = $this->cf->getManager('Mocktest');
43 $this->assertTrue($manager === $manager_alt);
46 // 強制的に違うオブジェクトを返さなければならない
47 $manager = $this->cf->getManager('mocktest');
48 $manager_alt = $this->cf->getManager('Mocktest', true);
49 $this->assertFalse($manager === $manager_alt);