public function testJoinWithI18nAddsTheI18nColumns()
 {
     $q = I18nBehaviorTest11Query::create()->joinWithI18n();
     $params = array();
     $sql = BasePeer::createSelectSQL($q, $params);
     $expectedSQL = 'SELECT i18n_behavior_test_11.ID, i18n_behavior_test_11.FOO, i18n_behavior_test_11_i18n.ID, i18n_behavior_test_11_i18n.LOCALE, i18n_behavior_test_11_i18n.BAR FROM i18n_behavior_test_11 LEFT JOIN i18n_behavior_test_11_i18n ON (i18n_behavior_test_11.ID=i18n_behavior_test_11_i18n.ID AND i18n_behavior_test_11_i18n.LOCALE = :p1)';
     $this->assertEquals($expectedSQL, $sql);
     $this->assertEquals('en_EN', $params[0]['value']);
 }
Пример #2
0
 public function testCommentDoSelect()
 {
     $c = new Criteria();
     $c->setComment('Foo');
     $c->addSelectColumn(BookPeer::ID);
     $expected = 'SELECT /* Foo */ book.ID FROM `book`';
     $params = array();
     $this->assertEquals($expected, BasePeer::createSelectSQL($c, $params), 'Criteria::setComment() adds a comment to select queries');
 }
 public function testJoinWithI18nAddsTheI18nColumns()
 {
     $q = I18nBehaviorTest11Query::create()->joinWithI18n();
     $params = array();
     $sql = BasePeer::createSelectSQL($q, $params);
     $expectedSQL = 'SELECT i18n_behavior_test_11.id, i18n_behavior_test_11.foo, i18n_behavior_test_11_i18n.id, i18n_behavior_test_11_i18n.locale, i18n_behavior_test_11_i18n.bar FROM i18n_behavior_test_11 LEFT JOIN i18n_behavior_test_11_i18n ON (i18n_behavior_test_11.id=i18n_behavior_test_11_i18n.id AND i18n_behavior_test_11_i18n.locale = :p1)';
     $this->assertEquals($expectedSQL, $sql);
     $this->assertEquals('en_US', $params[0]['value']);
 }