Phalcon\Test\Integration\Mvc\Collection\BehaviorCest::behaviors PHP Method

behaviors() public method

public behaviors ( IntegrationTester $I )
$I IntegrationTester
    public function behaviors(IntegrationTester $I)
    {
        $this->setupMongo($I);
        $I->wantToTest('using behaviors with collections');
        // Timestampable
        $subscriber = new Subs();
        $subscriber->email = '[email protected]';
        $subscriber->status = 'I';
        $I->assertTrue($subscriber->save());
        $I->assertEquals(1, preg_match('/[0-9]{4}-[0-9]{2}-[0-9]{2}/', $subscriber->created_at));
        // Soft delete
        $total = Subs::count();
        $subscriber = Subs::findFirst();
        $I->assertTrue($subscriber->delete());
        $I->assertEquals($subscriber->status, 'D');
        $I->assertEquals(Subs::count(), $total);
    }
BehaviorCest