Phalcon\Test\Unit\Mvc\Collection\ClassChangeCest::notACollection PHP Method

notACollection() public method

public notACollection ( UnitTester $I )
$I UnitTester
    public function notACollection(UnitTester $I)
    {
        $I->wantToTest("throwing exception when used not a collection class binding");
        $this->setupMongo($I);
        $book = new Books();
        $book->title = 'book';
        $I->assertTrue($book->save());
        $I->expectException(new Exception("Object of class '\\Phalcon\\Test\\Collections\\Bookshelf\\NotACollection' " . "must be an implementation of Phalcon\\Mvc\\CollectionInterface or an instance of Phalcon\\Mvc\\Collection\\Document"), function () use($book) {
            Books::findFirst([['_id' => $book->getId()], 'class' => '\\Phalcon\\Test\\Collections\\Bookshelf\\NotACollection']);
        });
        $I->assertTrue($book->delete());
    }