lithium\tests\cases\data\source\DatabaseTest::testCalculation PHP Method

testCalculation() public method

public testCalculation ( )
    public function testCalculation()
    {
        $options = array('type' => 'read', 'model' => $this->_model);
        $this->_db->return['_execute'] = new MockResult(array('records' => array(array(23))));
        $expected = 23;
        $result = $this->_db->calculation('count', new Query($options), $options);
        $this->assertEqual($expected, $result);
        $expected = 'SELECT COUNT(*) as count FROM {mock_database_posts} AS {MockDatabasePost};';
        $result = $this->_db->sql;
        $this->assertEqual($expected, $result);
        $this->_db->return['_execute'] = new MockResult(array('records' => array()));
        $result = $this->_db->calculation('count', new Query($options), $options);
        $this->assertNull($result);
    }
DatabaseTest