MockBasicEntity::update()->addWhere('id', '=', $id2)->addValue('foo', 'new')->execute();
$result = MockBasicEntity::get()->addOrderBy('id', 'DESC')->setLimit(1)->execute();
- $this->assertCount(1, $result);
+ // The object's count() method will account for all results, ignoring limit, while the array results are limited
+ $this->assertCount(2, $result);
+ $this->assertCount(1, (array) $result);
$this->assertEquals('new', $result->first()['foo']);
$result = MockBasicEntity::save()
$results = MockBasicEntity::get()
->addSelect('*', 'group:label', 'group:name', 'fruit:name', 'fruit:color', 'fruit:label')
+ ->addOrderBy('fruit:color', "DESC")
->execute();
$this->assertEquals('round', $results[0]['shape']);
$this->assertEquals('banana', $results[0]['fruit:name']);
$this->assertEquals('yellow', $results[0]['fruit:color']);
+ // Reverse order
+ $results = MockBasicEntity::get()
+ ->addOrderBy('fruit:color')
+ ->execute();
+ $this->assertEquals('two', $results[0]['group']);
+
// Cannot match to a non-unique option property like :color on create
try {
MockBasicEntity::create()->addValue('fruit:color', 'yellow')->execute();