public function test_gh16_has_many_through_inside_a_loop_should_not_cause_an_exception() { $count = 0; foreach (Venue::all() as $venue) { $count += count($venue->hosts); } $this->assert_true($count >= 5); }
public function testGroupWithOrderAndLimitAndHaving() { $venues = Venue::all(array('select' => 'state', 'group' => 'state', 'having' => 'length(state) = 2', 'order' => 'state', 'limit' => 2)); $this->assertTrue(count($venues) > 0); $this->assertSqlHas($this->conn->limit('SELECT state FROM venues GROUP BY state HAVING length(state) = 2 ORDER BY state', null, 2), Venue::table()->lastSql); }
public function test_group_with_order_and_limit_and_having() { $venues = Venue::all(array('select' => 'state', 'group' => 'state', 'having' => 'length(state) = 2', 'order' => 'state', 'limit' => 2)); $this->assert_true(count($venues) > 0); $this->assert_sql_has($this->conn->limit('SELECT state FROM venues GROUP BY state HAVING length(state) = 2 ORDER BY state', 0, 2), Venue::table()->last_sql); }
public function test_group_with_order_and_limit_and_having() { $venues = Venue::all(array('select' => 'state', 'group' => 'state', 'having' => 'length(state) = 2', 'order' => 'state', 'limit' => 2)); $this->assert_true(count($venues) > 0); $this->assert_true(strpos(ActiveRecord\Table::load('Venue')->last_sql, 'GROUP BY state HAVING length(state) = 2 ORDER BY state LIMIT 0,2') !== false); }
public function testGh16HasManyThroughInsideALoopShouldNotCauseAnException() { $count = 0; foreach (Venue::all() as $venue) { $count += count($venue->hosts); } $this->assertTrue($count >= 5); }