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

testCreate() public method

public testCreate ( )
    public function testCreate()
    {
        $entity = new Record(array('model' => $this->_model, 'data' => array('title' => 'new post', 'body' => 'the body')));
        $query = new Query(compact('entity') + array('type' => 'create', 'model' => $this->_model));
        $hash = $query->export($this->_db);
        ksort($hash);
        $expected = sha1(serialize($hash));
        $result = $this->_db->create($query);
        $this->assertTrue($result);
        $result = $query->entity()->id;
        $this->assertEqual($expected, $result);
        $expected = "INSERT INTO {mock_database_posts} ({title}, {body})";
        $expected .= " VALUES ('new post', 'the body');";
        $result = $this->_db->sql;
        $this->assertEqual($expected, $result);
    }
DatabaseTest