Pheasant\Tests\Transaction\TransactionTest::testDeferEventsFireOnCommit PHP Method

testDeferEventsFireOnCommit() public method

    public function testDeferEventsFireOnCommit()
    {
        $connection = \Mockery::mock('\\Pheasant\\Database\\Mysqli\\Connection');
        $connection->shouldReceive('execute')->with('BEGIN')->once();
        $connection->shouldReceive('execute')->with('COMMIT')->once();
        $events = \Mockery::mock();
        $events->shouldReceive('cork')->once();
        $events->shouldReceive('uncork')->once();
        $transaction = new Transaction($connection);
        $transaction->deferEvents($events);
        $transaction->callback(function () {
            return 'blargh';
        });
        $transaction->execute();
    }