/** * Test build statement with some fields missing * * @return void */ public function testBuildStatementDefaults() { $conn = $this->getMock('MockPDO', array('quote')); $conn->expects($this->at(0))->method('quote')->will($this->returnValue('foo bar')); $db = new DboTestSource(); $db->setConnection($conn); $subQuery = $db->buildStatement(array('fields' => array('DISTINCT(AssetsTag.asset_id)'), 'table' => "assets_tags", 'alias' => "AssetsTag", 'conditions' => array("Tag.name" => 'foo bar'), 'limit' => null, 'group' => "AssetsTag.asset_id"), $this->Model); $expected = 'SELECT DISTINCT(AssetsTag.asset_id) FROM assets_tags AS AssetsTag WHERE Tag.name = foo bar GROUP BY AssetsTag.asset_id'; $this->assertEquals($expected, $subQuery); }
/** * Test build statement with some fields missing * * @return void */ public function testBuildStatementDefaults() { $conn = $this->getMock('MockPDO'); $db = new DboTestSource(); $db->setConnection($conn); $subQuery = $db->buildStatement(array('fields' => array('DISTINCT(AssetsTag.asset_id)'), 'table' => "assets_tags", 'alias' => "AssetsTag", 'conditions' => array("Tag.name" => 'foo bar'), 'limit' => null, 'group' => "AssetsTag.asset_id"), $this->Model); }