| 19 | | |
| 20 | | $t->begin('__construct() with INDEXBY | Also tests limit()'); |
| 21 | | $q = new ullQuery('UllUserStatus', 'slug'); |
| 22 | | $q->addSelect('is_absent'); |
| 23 | | $q->limit(1); |
| 24 | | $t->is( |
| 25 | | $q->getSqlQuery(), |
| 26 | | "SELECT u.id AS u__id, u.slug AS u__slug, u.is_absent AS u__is_absent FROM ull_user_status u LIMIT 1", |
| 27 | | 'Created the correct SQL query' |
| 28 | | ); |
| 29 | | $t->is( |
| 30 | | $q->execute(array(), DOCTRINE::HYDRATE_ARRAY), |
| 31 | | array('active' => array('id' => 1, 'slug' => 'active', 'is_absent' => false)), |
| 32 | | 'Returns an indexed by array' |
| 33 | | ); |
| 34 | | |
| | 189 | $t->diag('__construct() with INDEXBY | Also tests limit()'); |
| | 190 | $q = new ullQuery('UllUserStatus', 'slug'); |
| | 191 | $q->addSelect('is_absent'); |
| | 192 | $q->limit(1); |
| | 193 | $t->is( |
| | 194 | $q->getSqlQuery(), |
| | 195 | "SELECT u.id AS u__id, u.slug AS u__slug, u.is_absent AS u__is_absent FROM ull_user_status u LIMIT 1", |
| | 196 | 'Created the correct SQL query' |
| | 197 | ); |
| | 198 | $t->is( |
| | 199 | $q->execute(array(), DOCTRINE::HYDRATE_ARRAY), |
| | 200 | array('active' => array('id' => 1, 'slug' => 'active', 'is_absent' => false)), |
| | 201 | 'Returns an indexed by array' |
| | 202 | ); |
| | 203 | |