@@ -4530,34 +4530,6 @@ public function testDeleteModifiers()
4530
4530
);
4531
4531
}
4532
4532
4533
- /**
4534
- * Tests that fetch returns an anonymous object when the string 'obj'
4535
- * is passed as an argument
4536
- *
4537
- * @return void
4538
- */
4539
- public function testSelectWithObjFetchType ()
4540
- {
4541
- $ this ->loadFixtures ('Comments ' );
4542
- $ query = new Query ($ this ->connection );
4543
- $ result = $ query
4544
- ->select (['id ' ])
4545
- ->from ('comments ' )
4546
- ->where (['id ' => '1 ' ])
4547
- ->execute ();
4548
- $ obj = (object )['id ' => 1 ];
4549
- $ this ->assertEquals ($ obj , $ result ->fetch ('obj ' ));
4550
-
4551
- $ query = new Query ($ this ->connection );
4552
- $ result = $ query
4553
- ->select (['id ' ])
4554
- ->from ('comments ' )
4555
- ->where (['id ' => '1 ' ])
4556
- ->execute ();
4557
- $ rows = $ result ->fetchAll ('obj ' );
4558
- $ this ->assertEquals ($ obj , $ rows [0 ]);
4559
- }
4560
-
4561
4533
/**
4562
4534
* Test getValueBinder()
4563
4535
*
@@ -4701,6 +4673,7 @@ public function assertQuotedQuery($pattern, $query, $optional = false)
4701
4673
/**
4702
4674
* Test that calling fetchAssoc return an associated array.
4703
4675
* @return void
4676
+ * @throws \Exception
4704
4677
*/
4705
4678
public function testFetchAssoc ()
4706
4679
{
@@ -4720,34 +4693,8 @@ public function testFetchAssoc()
4720
4693
}
4721
4694
4722
4695
/**
4723
- * Test that calling fetchObject returns a \stdClass object
4724
- * @return void
4725
- */
4726
- public function testFetchObject ()
4727
- {
4728
- $ this ->loadFixtures ('Profiles ' );
4729
- $ query = new Query ($ this ->connection );
4730
- $ results = $ query
4731
- ->select ([
4732
- 'id ' ,
4733
- 'user_id ' ,
4734
- 'is_active '
4735
- ])
4736
- ->from ('profiles ' )
4737
- ->limit (1 )
4738
- ->execute ()
4739
- ->fetchObject ();
4740
- $ this ->assertInstanceOf (\stdClass::class, $ results );
4741
- $ this ->assertObjectHasAttribute ('id ' , $ results );
4742
- $ this ->assertObjectHasAttribute ('user_id ' , $ results );
4743
- $ this ->assertObjectHasAttribute ('is_active ' , $ results );
4744
- $ this ->assertEquals ($ results ->id , '1 ' );
4745
- $ this ->assertEquals ($ results ->user_id , '1 ' );
4746
- $ this ->assertEquals ($ results ->is_active , '0 ' );
4747
- }
4748
-
4749
- /**
4750
- * Test that calling fetchColumn returns the correct column value.
4696
+ * Test that fetchColumn() will return the correct value at $position.
4697
+ * @throws \Exception
4751
4698
* @return void
4752
4699
*/
4753
4700
public function testFetchColumn ()
@@ -4772,8 +4719,9 @@ public function testFetchColumn()
4772
4719
* Test that calling fetchAssoc, fetchColum and fetchObject in sequence
4773
4720
* alters the fetched data to the correct types and values.
4774
4721
* @return void
4722
+ * @throws \Exception
4775
4723
*/
4776
- public function testFetchAllAssocColumnAndObj ()
4724
+ public function testFetchAllAssocColumn ()
4777
4725
{
4778
4726
$ this ->loadFixtures ('Profiles ' );
4779
4727
$ query = new Query ($ this ->connection );
@@ -4791,28 +4739,6 @@ public function testFetchAllAssocColumnAndObj()
4791
4739
$ this ->assertEquals ('2 ' , $ results ['id ' ]);
4792
4740
$ results = $ statement ->fetchColumn (0 );
4793
4741
$ this ->assertEquals ('3 ' , $ results [0 ]);
4794
- $ results = $ statement ->fetchObject ();
4795
- $ this ->assertEquals ('4 ' , $ results ->id );
4796
- }
4797
-
4798
- /**
4799
- * Test that an array of objects is returned
4800
- * @return void
4801
- */
4802
- public function testFetchAllObjects ()
4803
- {
4804
- $ this ->loadFixtures ('Profiles ' );
4805
- $ query = new Query ($ this ->connection );
4806
- $ query
4807
- ->select ([
4808
- 'id ' ,
4809
- 'user_id ' ,
4810
- 'is_active '
4811
- ])
4812
- ->from ('profiles ' );
4813
- $ statement = $ query ->execute ();
4814
- $ results = $ statement ->fetchAllObjects ();
4815
- $ this ->assertInstanceOf (\stdClass::class, $ results [0 ]);
4816
- $ this ->assertEquals ('2 ' , $ results [1 ]->id );
4817
4742
}
4818
4743
}
4744
+
0 commit comments