lithium\tests\cases\data\source\database\adapter\MySqlTest::testQueryOperators PHP Method

testQueryOperators() public method

We test only the operators that are added/removed/modified from the Database::$_operators. The latter are already tested in the Database case.
public testQueryOperators ( )
    public function testQueryOperators()
    {
        $query = new Query(array('type' => 'read', 'model' => $this->_model, 'conditions' => array('title' => array('regexp' => '^[a-z0-9]+(\\w)*$'))));
        $expected = "SELECT * FROM `mock_database_posts` AS `MockDatabasePost` WHERE ";
        $expected .= "(`title` REGEXP '^[a-z0-9]+(\\w)*\$');";
        $result = $this->_db->renderCommand($query);
        $this->assertEqual($expected, $result);
        $query = new Query(array('type' => 'read', 'model' => $this->_model, 'conditions' => array('title' => array('not regexp' => '^[a-z0-9]+(\\w)*$'))));
        $expected = "SELECT * FROM `mock_database_posts` AS `MockDatabasePost` WHERE ";
        $expected .= "(`title` NOT REGEXP '^[a-z0-9]+(\\w)*\$');";
        $result = $this->_db->renderCommand($query);
        $this->assertEqual($expected, $result);
        $query = new Query(array('type' => 'read', 'model' => $this->_model, 'conditions' => array('title' => array('sounds like' => 'foo'))));
        $expected = "SELECT * FROM `mock_database_posts` AS `MockDatabasePost` WHERE ";
        $expected .= "(`title` SOUNDS LIKE 'foo');";
        $result = $this->_db->renderCommand($query);
        $this->assertEqual($expected, $result);
    }