Changeset 4964 for trunk/tests/Orm
- Timestamp:
- 09/13/08 13:40:17 (4 months ago)
- Files:
-
- 1 modified
-
trunk/tests/Orm/Hydration/BasicHydrationTest.php (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/Orm/Hydration/BasicHydrationTest.php
r4944 r4964 17 17 { 18 18 return array( 19 array('hydrationMode' => Doctrine ::HYDRATE_RECORD),20 array('hydrationMode' => Doctrine ::HYDRATE_ARRAY),21 array('hydrationMode' => Doctrine ::HYDRATE_SCALAR)19 array('hydrationMode' => Doctrine_Query::HYDRATE_OBJECT), 20 array('hydrationMode' => Doctrine_Query::HYDRATE_ARRAY), 21 array('hydrationMode' => Doctrine_Query::HYDRATE_SCALAR) 22 22 ); 23 23 } … … 77 77 $stmt, $queryComponents, $tableAliasMap, $hydrationMode)); 78 78 79 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY || $hydrationMode == Doctrine::HYDRATE_RECORD) {79 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY || $hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 80 80 $this->assertEquals(2, count($result)); 81 81 $this->assertEquals(1, $result[0]['id']); … … 85 85 } 86 86 87 if ($hydrationMode == Doctrine ::HYDRATE_RECORD) {87 if ($hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 88 88 $this->assertTrue($result instanceof Doctrine_ORM_Collection); 89 89 $this->assertTrue($result[0] instanceof Doctrine_ORM_Entity); 90 90 $this->assertTrue($result[1] instanceof Doctrine_ORM_Entity); 91 } else if ($hydrationMode == Doctrine ::HYDRATE_ARRAY) {91 } else if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY) { 92 92 $this->assertTrue(is_array($result)); 93 } else if ($hydrationMode == Doctrine ::HYDRATE_SCALAR) {93 } else if ($hydrationMode == Doctrine_Query::HYDRATE_SCALAR) { 94 94 $this->assertTrue(is_array($result)); 95 95 $this->assertEquals(2, count($result)); … … 164 164 $stmt, $queryComponents, $tableAliasMap, $hydrationMode, true)); 165 165 166 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY) {166 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY) { 167 167 //var_dump($result); 168 168 } 169 169 170 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY || $hydrationMode == Doctrine::HYDRATE_RECORD) {170 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY || $hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 171 171 $this->assertEquals(2, count($result)); 172 172 $this->assertTrue(is_array($result)); … … 186 186 } 187 187 188 if ($hydrationMode == Doctrine ::HYDRATE_RECORD) {188 if ($hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 189 189 $this->assertTrue($result[0][0] instanceof Doctrine_ORM_Entity); 190 190 $this->assertTrue($result[0][0]['phonenumbers'] instanceof Doctrine_ORM_Collection); … … 193 193 $this->assertTrue($result[1][0] instanceof Doctrine_ORM_Entity); 194 194 $this->assertTrue($result[1][0]['phonenumbers'] instanceof Doctrine_ORM_Collection); 195 } else if ($hydrationMode == Doctrine ::HYDRATE_SCALAR) {195 } else if ($hydrationMode == Doctrine_Query::HYDRATE_SCALAR) { 196 196 $this->assertTrue(is_array($result)); 197 197 $this->assertEquals(3, count($result)); … … 261 261 //var_dump($result); 262 262 263 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY || $hydrationMode == Doctrine::HYDRATE_RECORD) {263 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY || $hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 264 264 $this->assertEquals(2, count($result)); 265 265 $this->assertTrue(is_array($result)); … … 273 273 } 274 274 275 if ($hydrationMode == Doctrine ::HYDRATE_RECORD) {275 if ($hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 276 276 $this->assertTrue($result[0][0] instanceof Doctrine_ORM_Entity); 277 277 $this->assertTrue($result[1][0] instanceof Doctrine_ORM_Entity); 278 } else if ($hydrationMode == Doctrine ::HYDRATE_SCALAR) {278 } else if ($hydrationMode == Doctrine_Query::HYDRATE_SCALAR) { 279 279 $this->assertEquals(2, count($result)); 280 280 … … 356 356 } 357 357 358 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY || $hydrationMode == Doctrine::HYDRATE_RECORD) {358 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY || $hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 359 359 $this->assertEquals(2, count($result)); 360 360 $this->assertTrue(is_array($result)); … … 377 377 } 378 378 379 if ($hydrationMode == Doctrine ::HYDRATE_RECORD) {379 if ($hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 380 380 $this->assertTrue($result[0]['1'] instanceof Doctrine_ORM_Entity); 381 381 $this->assertTrue($result[1]['2'] instanceof Doctrine_ORM_Entity); 382 382 $this->assertTrue($result[0]['1']['phonenumbers'] instanceof Doctrine_ORM_Collection); 383 383 $this->assertEquals(2, count($result[0]['1']['phonenumbers'])); 384 } else if ($hydrationMode == Doctrine ::HYDRATE_SCALAR) {384 } else if ($hydrationMode == Doctrine_Query::HYDRATE_SCALAR) { 385 385 // NOTE: Indexing has no effect with HYDRATE_SCALAR 386 386 //... asserts to come … … 492 492 $result = $hydrator->hydrateResultSet($this->_createParserResult( 493 493 $stmt, $queryComponents, $tableAliasMap, $hydrationMode, true)); 494 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY) {494 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY) { 495 495 //var_dump($result); 496 496 } 497 497 498 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY || $hydrationMode == Doctrine::HYDRATE_RECORD) {498 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY || $hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 499 499 $this->assertEquals(2, count($result)); 500 500 $this->assertTrue(is_array($result)); … … 521 521 } 522 522 523 if ($hydrationMode == Doctrine ::HYDRATE_RECORD) {523 if ($hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 524 524 $this->assertTrue($result[0][0] instanceof Doctrine_ORM_Entity); 525 525 $this->assertTrue($result[0][0]['phonenumbers'] instanceof Doctrine_ORM_Collection); … … 534 534 $this->assertTrue($result[1][0]['articles'][0] instanceof Doctrine_ORM_Entity); 535 535 $this->assertTrue($result[1][0]['articles'][1] instanceof Doctrine_ORM_Entity); 536 } else if ($hydrationMode == Doctrine ::HYDRATE_SCALAR) {536 } else if ($hydrationMode == Doctrine_Query::HYDRATE_SCALAR) { 537 537 //... 538 538 $this->assertEquals(6, count($result)); … … 667 667 $result = $hydrator->hydrateResultSet($this->_createParserResult( 668 668 $stmt, $queryComponents, $tableAliasMap, $hydrationMode, true)); 669 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY) {669 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY) { 670 670 //var_dump($result); 671 671 } 672 672 673 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY || $hydrationMode == Doctrine::HYDRATE_RECORD) {673 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY || $hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 674 674 $this->assertEquals(2, count($result)); 675 675 $this->assertTrue(is_array($result)); … … 705 705 } 706 706 707 if ($hydrationMode == Doctrine ::HYDRATE_RECORD) {707 if ($hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 708 708 $this->assertTrue($result[0][0] instanceof Doctrine_ORM_Entity); 709 709 $this->assertTrue($result[1][0] instanceof Doctrine_ORM_Entity); … … 730 730 $this->assertTrue($result[1][0]['articles'][1]['comments'] instanceof Doctrine_ORM_Collection); 731 731 $this->assertEquals(0, count($result[1][0]['articles'][1]['comments'])); 732 } else if ($hydrationMode == Doctrine ::HYDRATE_SCALAR) {732 } else if ($hydrationMode == Doctrine_Query::HYDRATE_SCALAR) { 733 733 //... 734 } else if ($hydrationMode == Doctrine ::HYDRATE_ARRAY) {734 } else if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY) { 735 735 //... 736 736 … … 832 832 $result = $hydrator->hydrateResultSet($this->_createParserResult( 833 833 $stmt, $queryComponents, $tableAliasMap, $hydrationMode)); 834 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY) {834 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY) { 835 835 //var_dump($result); 836 836 } 837 837 838 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY || $hydrationMode == Doctrine::HYDRATE_RECORD) {838 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY || $hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 839 839 $this->assertEquals(2, count($result)); 840 840 $this->assertTrue(isset($result[0]['boards'])); … … 844 844 } 845 845 846 if ($hydrationMode == Doctrine ::HYDRATE_ARRAY) {846 if ($hydrationMode == Doctrine_Query::HYDRATE_ARRAY) { 847 847 $this->assertTrue(is_array($result)); 848 848 $this->assertTrue(is_array($result[0])); 849 849 $this->assertTrue(is_array($result[1])); 850 } else if ($hydrationMode == Doctrine ::HYDRATE_RECORD) {850 } else if ($hydrationMode == Doctrine_Query::HYDRATE_OBJECT) { 851 851 $this->assertTrue($result instanceof Doctrine_ORM_Collection); 852 852 $this->assertTrue($result[0] instanceof Doctrine_ORM_Entity); 853 853 $this->assertTrue($result[1] instanceof Doctrine_ORM_Entity); 854 } else if ($hydrationMode == Doctrine ::HYDRATE_SCALAR) {854 } else if ($hydrationMode == Doctrine_Query::HYDRATE_SCALAR) { 855 855 //... 856 856 } … … 923 923 if ($name == 'result1') { 924 924 $result = $hydrator->hydrateResultSet($this->_createParserResult( 925 $stmt, $queryComponents, $tableAliasMap, Doctrine ::HYDRATE_SINGLE_SCALAR));925 $stmt, $queryComponents, $tableAliasMap, Doctrine_Query::HYDRATE_SINGLE_SCALAR)); 926 926 $this->assertEquals('romanb', $result); 927 927 } else if ($name == 'result2') { 928 928 $result = $hydrator->hydrateResultSet($this->_createParserResult( 929 $stmt, $queryComponents, $tableAliasMap, Doctrine ::HYDRATE_SINGLE_SCALAR));929 $stmt, $queryComponents, $tableAliasMap, Doctrine_Query::HYDRATE_SINGLE_SCALAR)); 930 930 $this->assertEquals(1, $result); 931 931 } else if ($name == 'result3' || $name == 'result4') { 932 932 try { 933 933 $result = $hydrator->hydrateResultSet($this->_createParserResult( 934 $stmt, $queryComponents, $tableAliasMap, Doctrine ::HYDRATE_SINGLE_SCALAR));934 $stmt, $queryComponents, $tableAliasMap, Doctrine_Query::HYDRATE_SINGLE_SCALAR)); 935 935 $this->fail(); 936 936 } catch (Doctrine_ORM_Exceptions_HydrationException $ex) {}