Skip to content

Commit

Permalink
Added test #11795
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Opitz committed May 10, 2018
1 parent 3a87631 commit fd022b6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/TestCase/Database/QueryTest.php
Expand Up @@ -4779,6 +4779,25 @@ public function testFetchAssoc()
$this->assertSame(['id' => 1, 'user_id' => 1, 'is_active' => false], $results);
}

/**
* Test that calling fetchAssoc return an empty associated array.
* @return void
* @throws \Exception
*/
public function testFetchAssocWithEmptyResult()
{
$this->loadFixtures('Profiles');
$query = new Query($this->connection);

$results = $query
->select(['id'])
->from('profiles')
->where(['id' => -1])
->execute()
->fetchAssoc();
$this->assertSame([], $results);
}

/**
* Test that calling fetch with with FETCH_TYPE_OBJ return stdClass object.
* @return void
Expand Down

0 comments on commit fd022b6

Please sign in to comment.