コード例 #1
0
 public function test_has_many_with_joins()
 {
     $x = Venue::first(array('joins' => array('events')));
     $this->assert_sql_has('INNER JOIN events ON(venues.id = events.venue_id)', Venue::table()->last_sql);
 }
コード例 #2
0
 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);
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 public function set_up($connection_name = null)
 {
     parent::set_up($connection_name);
     $this->venue = new Venue();
     $this->callback = Venue::table()->callback;
 }
コード例 #5
0
 public function testHasManyWithJoins()
 {
     $x = Venue::first(array('joins' => array('events')));
     $this->assertSqlHas('INNER JOIN events ON(venues.id = events.venue_id)', Venue::table()->lastSql);
 }
コード例 #6
0
 public function test_has_many_with_joins()
 {
     $x = Venue::first(array('joins' => array('events')));
     $this->assert_true(strpos(Venue::table()->last_sql, 'INNER JOIN `events` ON(`venues`.id = `events`.venue_id)') !== false);
 }