Phalcon\Test\Unit\Mvc\Model\Transaction\ManagerTest::testTransactionRemovedOnCommit PHP Method

testTransactionRemovedOnCommit() public method

Tests transaction is removed when committed.
Since: 2016-04-09
Author: Nochum Sossonko ([email protected])
    public function testTransactionRemovedOnCommit()
    {
        $this->specify("Test does not remove transaction when committed", function () {
            $tm = new Manager();
            $transaction = $tm->get(true);
            $select = new Select();
            $select->setTransaction($transaction);
            $select->create(['name' => 'Crack of Dawn']);
            expect($this->tester->getProtectedProperty($tm, '_number'))->equals(1);
            expect($this->tester->getProtectedProperty($tm, '_transactions'))->count(1);
            $transaction->commit();
            expect($this->tester->getProtectedProperty($tm, '_number'))->equals(0);
            expect($this->tester->getProtectedProperty($tm, '_transactions'))->count(0);
        });
    }