lithium\tests\cases\data\ModelTest::testSave PHP Метод

testSave() публичный Метод

public testSave ( )
    public function testSave()
    {
        MockPost::config(array('schema' => $this->_altSchema));
        MockPost::config(array('schema' => new Schema()));
        $data = array('title' => 'New post', 'author_id' => 13, 'foo' => 'bar');
        $record = MockPost::create($data);
        $result = $record->save();
        $this->assertEqual('create', $result['query']->type());
        $this->assertEqual($data, $result['query']->data());
        $this->assertEqual('lithium\\tests\\mocks\\data\\MockPost', $result['query']->model());
        MockPost::config(array('schema' => $this->_altSchema));
        $record->tags = array("baz", "qux");
        $otherData = array('body' => 'foobar');
        $result = $record->save($otherData);
        $data['body'] = 'foobar';
        $data['tags'] = array("baz", "qux");
        $expected = array('title' => 'New post', 'author_id' => 13, 'body' => 'foobar');
        $this->assertNotEqual($data, $result['query']->data());
    }
ModelTest