Skip to content

Commit fd022b6

Browse files
author
Daniel Opitz
committed
Added test #11795
1 parent 3a87631 commit fd022b6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/TestCase/Database/QueryTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4779,6 +4779,25 @@ public function testFetchAssoc()
47794779
$this->assertSame(['id' => 1, 'user_id' => 1, 'is_active' => false], $results);
47804780
}
47814781

4782+
/**
4783+
* Test that calling fetchAssoc return an empty associated array.
4784+
* @return void
4785+
* @throws \Exception
4786+
*/
4787+
public function testFetchAssocWithEmptyResult()
4788+
{
4789+
$this->loadFixtures('Profiles');
4790+
$query = new Query($this->connection);
4791+
4792+
$results = $query
4793+
->select(['id'])
4794+
->from('profiles')
4795+
->where(['id' => -1])
4796+
->execute()
4797+
->fetchAssoc();
4798+
$this->assertSame([], $results);
4799+
}
4800+
47824801
/**
47834802
* Test that calling fetch with with FETCH_TYPE_OBJ return stdClass object.
47844803
* @return void

0 commit comments

Comments
 (0)