Phalcon\Test\Unit\Mvc\CollectionTest::testShouldCatchExceptionOnUpdateNonExistentDocument PHP Method

testShouldCatchExceptionOnUpdateNonExistentDocument() public method

Tests triggering exception on update non existent document
Since: 2016-03-03
Author: Serghei Iakovlev ([email protected])
    public function testShouldCatchExceptionOnUpdateNonExistentDocument()
    {
        $this->specify("Test does not catch Collection Exception on update non existent document", function () {
            $song = new Songs();
            $song->artist = 'Cinema Strange';
            $song->name = 'Legs and Tarpaulin';
            $song->update();
        }, ['throws' => ['Phalcon\\Mvc\\Collection\\Exception', "The document cannot be updated because it doesn't exist"]]);
    }