Created
May 22, 2010 12:32
-
-
Save anonymous/410039 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require_once dirname(__FILE__) . '/../../../TestHelper.php'; | |
| require_once 'Zfast/Compiler/Detector/Oop.php'; | |
| require_once 'Zfast/Compiler/Class.php'; | |
| class Zfast_Compiler_Detector_OopTest extends PHPUnit_Framework_TestCase { | |
| public function testDetectImplementedInterfaces() { | |
| $detector = new Zfast_Compiler_Detector_Oop(); | |
| // implements one interface | |
| $source = Zfast_Compiler_Class::factory('<?php class A implements B {}', '/tmp/A.php'); | |
| $this->assertEquals(array('B'), $detector->detect($source->getSource())); | |
| // implements many interfaces | |
| $source = Zfast_Compiler_Class::factory('<?php class A implements B, C, D, E, F {}', '/tmp/A.php'); | |
| $this->assertEquals(array('B', 'C', 'D', 'E', 'F'), $detector->detect($source->getSource())); | |
| } | |
| public function testDetectExtendedClasses() { | |
| $detector = new Zfast_Compiler_Detector_Oop(); | |
| // extends class B | |
| $source = Zfast_Compiler_Class::factory('<?php class A extends B {}', '/tmp/A.php'); | |
| $this->assertEquals(array('B'), $detector->detect($source->getSource())); | |
| // extends class C | |
| $source = Zfast_Compiler_Class::factory('<?php class A extends C {}', '/tmp/A.php'); | |
| $this->assertEquals(array('C'), $detector->detect($source->getSource())); | |
| } | |
| public function testNoDependencies() { | |
| $detector = new Zfast_Compiler_Detector_Oop(); | |
| // class A | |
| $source = Zfast_Compiler_Class::factory('<?php class A {}', '/tmp/A.php'); | |
| $this->assertEquals(array(), $detector->detect($source->getSource())); | |
| } | |
| public function testDetectsClassesAndInterfaces() { | |
| $detector = new Zfast_Compiler_Detector_Oop(); | |
| // extends and implements | |
| $source = Zfast_Compiler_Class::factory('<?php class A extends B implements C, D, E, F {}', '/tmp/A.php'); | |
| $this->assertEquals(array('B', 'C', 'D', 'E', 'F'), $detector->detect($source->getSource())); | |
| } | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment