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

testCreateWithKey() public method

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