Changeset 697
- Timestamp:
- 05/31/07 22:48:08 (1 year ago)
- Files:
-
- trunk/src/main/php/net/stubbles/reflection/stubReflectionParameter.php (modified) (6 diffs)
- trunk/src/test/php/net/stubbles/reflection/stubReflectionClassTestCase.php (modified) (13 diffs)
- trunk/src/test/php/net/stubbles/reflection/stubReflectionExtensionTestCase.php (modified) (4 diffs)
- trunk/src/test/php/net/stubbles/reflection/stubReflectionFunctionTestCase.php (modified) (4 diffs)
- trunk/src/test/php/net/stubbles/reflection/stubReflectionMethodTestCase.php (modified) (5 diffs)
- trunk/src/test/php/net/stubbles/reflection/stubReflectionObjectTestCase.php (modified) (13 diffs)
- trunk/src/test/php/net/stubbles/reflection/stubReflectionParameterTestCase.php (modified) (5 diffs)
- trunk/src/test/php/net/stubbles/reflection/stubReflectionPropertyTestCase.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/reflection/stubReflectionParameter.php
r253 r697 30 30 */ 31 31 protected $paramName; 32 32 33 33 /** 34 34 * constructor … … 43 43 parent::__construct($functionName, $paramName); 44 44 } 45 45 46 46 /** 47 47 * checks whether a value is equal to the class … … 68 68 return ($compareClass->getName() == $class->getName() && $compare->functionName == $this->functionName && $compare->paramName == $this->paramName); 69 69 } 70 70 71 71 /** 72 72 * returns a string representation of the class … … 86 86 public function __toString() 87 87 { 88 $class = $this->getDeclaringClass(); 89 if (null == $class) { 88 if (is_array($this->functionName) == false) { 90 89 return 'net.stubbles.reflection.stubReflectionParameter[' . $this->functionName . '(): Argument ' . $this->paramName . "] {\n}\n"; 91 90 } 92 91 93 return 'net.stubbles.reflection.stubReflectionParameter[' . $ class->getName() . '::' . $this->functionName. '(): Argument ' . $this->paramName . "] {\n}\n";92 return 'net.stubbles.reflection.stubReflectionParameter[' . $this->functionName[0] . '::' . $this->functionName[1] . '(): Argument ' . $this->paramName . "] {\n}\n"; 94 93 } 95 94 96 95 /** 97 96 * returns the function that declares this parameter … … 108 107 return $stubRefFunction; 109 108 }*/ 110 109 111 110 /** 112 111 * returns the class that declares this parameter … … 124 123 return $stubRefClass; 125 124 } 126 125 127 126 /** 128 127 * returns the type (class) hint for this parameter trunk/src/test/php/net/stubbles/reflection/stubReflectionClassTestCase.php
r408 r697 30 30 */ 31 31 protected $stubRefClass2; 32 32 33 33 /** 34 34 * set up the test environment … … 39 39 $this->stubRefClass2 = new stubReflectionClass('stubTestWithOutMethodsAndProperties'); 40 40 } 41 41 42 42 /** 43 43 * assure that instances of stubReflectionClass for the same class are equal … … 55 55 $this->assertFalse($this->stubRefClass2->equals($stubRefClass)); 56 56 } 57 57 58 58 /** 59 59 * test behaviour if casted to string … … 61 61 public function testToString() 62 62 { 63 $this->assert True((string) $this->stubRefClass1, "reflection.stubReflectionClass[stubTestWithMethodsAndProperties] {\n}\n");64 $this->assert True((string) $this->stubRefClass2, "reflection.stubReflectionClass[stubTestWithOutMethodsAndProperties] {\n}\n");63 $this->assertEqual((string) $this->stubRefClass1, "net.stubbles.reflection.stubReflectionClass[stubTestWithMethodsAndProperties] {\n}\n"); 64 $this->assertEqual((string) $this->stubRefClass2, "net.stubbles.reflection.stubReflectionClass[stubTestWithOutMethodsAndProperties] {\n}\n"); 65 65 } 66 66 67 67 /** 68 68 * test the full qualified class name … … 73 73 $this->assertEqual($this->stubRefClass2->getFullQualifiedClassName(), 'stubTestWithOutMethodsAndProperties'); 74 74 } 75 75 76 76 /** 77 77 * test that getting the constructor method works correct … … 85 85 $this->assertNull($this->stubRefClass2->getConstructor()); 86 86 } 87 87 88 88 /** 89 89 * test that getting the specified method works correct … … 98 98 $this->assertNull($stubRefMethod); 99 99 } 100 100 101 101 /** 102 102 * test that getting the methods works correct … … 113 113 $this->assertEqual(count($stubRefMethods), 0); 114 114 } 115 115 116 116 /** 117 117 * test that getting the specified property works correct … … 126 126 $this->assertNull($stubRefProperty); 127 127 } 128 128 129 129 /** 130 130 * test that getting the properties works as expected … … 141 141 $this->assertEqual(count($stubRefMethods), 0); 142 142 } 143 143 144 144 /** 145 145 * test that getting the interfaces works correct … … 157 157 $this->assertEqual(count($stubRefClasses), 0); 158 158 } 159 159 160 160 /** 161 161 * test that getting the parent class works correct … … 169 169 $this->assertNull($this->stubRefClass2->getParentClass()); 170 170 } 171 171 172 172 /** 173 173 * test that getting the extension works correct … … 179 179 $this->assertIsA($refClass->getExtension(), 'stubReflectionExtension'); 180 180 } 181 181 182 182 /** 183 183 * test that class loading works as expected trunk/src/test/php/net/stubbles/reflection/stubReflectionExtensionTestCase.php
r98 r697 22 22 */ 23 23 protected $stubRefExtension; 24 24 25 25 /** 26 26 * set up the test environment … … 32 32 $this->stubRefExtension = new stubReflectionExtension('date'); 33 33 } 34 34 35 35 /** 36 36 * assure that instances of stubReflectionExtension for the same class are equal … … 47 47 $this->assertFalse($stubRefExtension2->equals($this->stubRefExtension)); 48 48 } 49 49 50 50 /** 51 51 * test behaviour if casted to string … … 53 53 public function testToString() 54 54 { 55 $this->assert True((string) $this->stubRefExtension, "reflection.stubRefExtension[date] {\n}\n");55 $this->assertEqual((string) $this->stubRefExtension, "net.stubbles.reflection.stubReflectionExtension[date] {\n}\n"); 56 56 } 57 57 trunk/src/test/php/net/stubbles/reflection/stubReflectionFunctionTestCase.php
r155 r697 30 30 */ 31 31 protected $stubRefFunction2; 32 32 33 33 /** 34 34 * set up the test environment … … 39 39 $this->stubRefFunction2 = new stubReflectionFunction('stubTestWithOutParams'); 40 40 } 41 41 42 42 /** 43 43 * assure that instances of stubReflectionClass for the same class are equal … … 55 55 $this->assertFalse($this->stubRefFunction2->equals($stubRefFunction)); 56 56 } 57 57 58 58 /** 59 59 * test behaviour if casted to string … … 61 61 public function testToString() 62 62 { 63 $this->assert True((string) $this->stubRefFunction1, "reflection.stubReflectionFunction[stubTestWithParams()] {\n}\n");64 $this->assert True((string) $this->stubRefFunction2, "reflection.stubReflectionFunction[stubTestWithOutParams()] {\n}\n");63 $this->assertEqual((string) $this->stubRefFunction1, "net.stubbles.reflection.stubReflectionFunction[stubTestWithParams()] {\n}\n"); 64 $this->assertEqual((string) $this->stubRefFunction2, "net.stubbles.reflection.stubReflectionFunction[stubTestWithOutParams()] {\n}\n"); 65 65 } 66 66 trunk/src/test/php/net/stubbles/reflection/stubReflectionMethodTestCase.php
r98 r697 65 65 */ 66 66 protected $stubRefMethod5; 67 67 68 68 /** 69 69 * set up the test environment … … 77 77 $this->stubRefMethod5 = new stubReflectionMethod('stubTest2', 'methodWithParams2'); 78 78 } 79 79 80 80 /** 81 81 * assure that instances of stubReflectionClass for the same class are equal … … 117 117 $this->assertFalse($this->stubRefMethod5->equals($stubRefMethod)); 118 118 } 119 119 120 120 /** 121 121 * test behaviour if casted to string … … 123 123 public function testToString() 124 124 { 125 $this->assert True((string) $this->stubRefMethod1, "reflection.stubReflectionClass[stubTest::methodWithoutParams()] {\n}\n");126 $this->assert True((string) $this->stubRefMethod2, "reflection.stubReflectionClass[stubTest::methodWithParams()] {\n}\n");127 $this->assert True((string) $this->stubRefMethod3, "reflection.stubReflectionClass[stubTest2::methodWithoutParams()] {\n}\n");128 $this->assert True((string) $this->stubRefMethod4, "reflection.stubReflectionClass[stubTest2::methodWithParams()] {\n}\n");129 $this->assert True((string) $this->stubRefMethod5, "reflection.stubReflectionClass[stubTest2::methodWithParams2()] {\n}\n");125 $this->assertEqual((string) $this->stubRefMethod1, "net.stubbles.reflection.stubReflectionMethod[stubTest::methodWithoutParams()] {\n}\n"); 126 $this->assertEqual((string) $this->stubRefMethod2, "net.stubbles.reflection.stubReflectionMethod[stubTest::methodWithParams()] {\n}\n"); 127 $this->assertEqual((string) $this->stubRefMethod3, "net.stubbles.reflection.stubReflectionMethod[stubTest2::methodWithoutParams()] {\n}\n"); 128 $this->assertEqual((string) $this->stubRefMethod4, "net.stubbles.reflection.stubReflectionMethod[stubTest2::methodWithParams()] {\n}\n"); 129 $this->assertEqual((string) $this->stubRefMethod5, "net.stubbles.reflection.stubReflectionMethod[stubTest2::methodWithParams2()] {\n}\n"); 130 130 } 131 131 132 132 /** 133 133 * test that getting the declaring class works correct … … 155 155 $this->assertEqual($stubRefClass->getName(), 'stubTest2'); 156 156 } 157 157 158 158 /** 159 159 * test that getting the parameters works correct trunk/src/test/php/net/stubbles/reflection/stubReflectionObjectTestCase.php
r255 r697 41 41 */ 42 42 protected $reflectedObject2; 43 43 44 44 /** 45 45 * set up the test environment … … 52 52 $this->stubRefClass2 = new stubReflectionObject($this->reflectedObject2); 53 53 } 54 54 55 55 /** 56 56 * assure that instances of stubReflectionClass for the same class are equal … … 68 68 $this->assertFalse($this->stubRefClass2->equals($stubRefClass)); 69 69 } 70 70 71 71 /** 72 72 * test behaviour if casted to string … … 74 74 public function testToString() 75 75 { 76 $this->assert True((string) $this->stubRefClass1, "reflection.stubReflectionObject[stubTestWithMethodsAndProperties] {\n}\n");77 $this->assert True((string) $this->stubRefClass2, "reflection.stubReflectionObject[stubTestWithOutMethodsAndProperties] {\n}\n");78 } 79 76 $this->assertEqual((string) $this->stubRefClass1, "net.stubbles.reflection.stubReflectionObject[stubTestWithMethodsAndProperties] {\n}\n"); 77 $this->assertEqual((string) $this->stubRefClass2, "net.stubbles.reflection.stubReflectionObject[stubTestWithOutMethodsAndProperties] {\n}\n"); 78 } 79 80 80 /** 81 81 * test the full qualified class name … … 86 86 $this->assertEqual($this->stubRefClass2->getFullQualifiedClassName(), 'stubTestWithOutMethodsAndProperties'); 87 87 } 88 88 89 89 /** 90 90 * test that the original object instance is returned … … 97 97 $this->assertReference($reflectedObject2, $this->reflectedObject2); 98 98 } 99 99 100 100 /** 101 101 * test that getting the constructor method works correct … … 109 109 $this->assertNull($this->stubRefClass2->getConstructor()); 110 110 } 111 111 112 112 /** 113 113 * test that getting the specified method works correct … … 122 122 $this->assertNull($stubRefMethod); 123 123 } 124 124 125 125 /** 126 126 * test that getting the methods works correct … … 137 137 $this->assertEqual(count($stubRefMethods), 0); 138 138 } 139 139 140 140 /** 141 141 * test that getting the specified property works correct … … 150 150 $this->assertNull($stubRefProperty); 151 151 } 152 152 153 153 /** 154 154 * test that getting the properties works as expected … … 165 165 $this->assertEqual(count($stubRefMethods), 0); 166 166 } 167 167 168 168 /** 169 169 * test that getting the interfaces works correct … … 181 181 $this->assertEqual(count($stubRefClasses), 0); 182 182 } 183 183 184 184 /** 185 185 * test that getting the parent class works correct … … 193 193 $this->assertNull($this->stubRefClass2->getParentClass()); 194 194 } 195 195 196 196 /** 197 197 * test that getting the extension works correct trunk/src/test/php/net/stubbles/reflection/stubReflectionParameterTestCase.php
r98 r697 69 69 */ 70 70 protected $stubRefParamMethod4; 71 71 72 72 /** 73 73 * create the test environment … … 81 81 $this->stubRefParamMethod4 = new stubReflectionParameter(array('stubParamTest2', 'paramTest3'), 'param2'); 82 82 } 83 83 84 84 /** 85 85 * assure that instances of stubReflectionClass for the same class are equal … … 127 127 $this->assertFalse($this->stubRefParamMethod4->equals($stubRefParamMethod)); 128 128 } 129 129 130 130 /** 131 131 * test behaviour if casted to string … … 133 133 public function testToString() 134 134 { 135 $this->assert True((string) $this->stubRefParamFunction, "reflection.stubReflectionParameter[stubtest_function(): Argument param] {\n}\n");136 $this->assert True((string) $this->stubRefParamMethod1, "reflection.stubReflectionParameter[stubParamTest::paramTest(): Argument param] {\n}\n");137 $this->assert True((string) $this->stubRefParamMethod2, "reflection.stubReflectionParameter[stubParamTest2::paramTest(): Argument param] {\n}\n");138 $this->assert True((string) $this->stubRefParamMethod3, "reflection.stubReflectionParameter[stubParamTest2::paramTest2(): Argument param2] {\n}\n");139 $this->assert True((string) $this->stubRefParamMethod4, "reflection.stubReflectionParameter[stubParamTest2::paramTest3(): Argument param2] {\n}\n");135 $this->assertEqual((string) $this->stubRefParamFunction, "net.stubbles.reflection.stubReflectionParameter[stubtest_function(): Argument param] {\n}\n"); 136 $this->assertEqual((string) $this->stubRefParamMethod1, "net.stubbles.reflection.stubReflectionParameter[stubParamTest::paramTest(): Argument param] {\n}\n"); 137 $this->assertEqual((string) $this->stubRefParamMethod2, "net.stubbles.reflection.stubReflectionParameter[stubParamTest2::paramTest(): Argument param] {\n}\n"); 138 $this->assertEqual((string) $this->stubRefParamMethod3, "net.stubbles.reflection.stubReflectionParameter[stubParamTest2::paramTest2(): Argument param2] {\n}\n"); 139 $this->assertEqual((string) $this->stubRefParamMethod4, "net.stubbles.reflection.stubReflectionParameter[stubParamTest2::paramTest3(): Argument param2] {\n}\n"); 140 140 } 141 141 142 142 /** 143 143 * test that getting the functions works correct … … 159 159 $this->assertEqual($refClass->getName(), 'stubParamTest2'); 160 160 } 161 161 162 162 /** 163 163 * test that getting the type (class) hints works correct trunk/src/test/php/net/stubbles/reflection/stubReflectionPropertyTestCase.php
r98 r697 27 27 */ 28 28 protected $stubRefProperty; 29 29 30 30 /** 31 31 * set up the test environment … … 35 35 $this->stubRefProperty = new stubReflectionProperty('stubTestProperty', 'property'); 36 36 } 37 37 38 38 /** 39 39 * assure that instances of stubReflectionExtension for the same class are equal … … 50 50 $this->assertFalse($stubRefProperty2->equals($this->stubRefProperty)); 51 51 } 52 52 53 53 /** 54 54 * test behaviour if casted to string … … 56 56 public function testToString() 57 57 { 58 $this->assert True((string) $this->stubRefProperty, "reflection.stubRefExtension[stubTestProperty::property] {\n}\n");58 $this->assertEqual((string) $this->stubRefProperty, "net.stubbles.reflection.stubReflectionProperty[stubTestProperty::property] {\n}\n"); 59 59 } 60 60
