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

testExceptionsCauseRollback() public method

    public function testExceptionsCauseRollback()
    {
        $connection = \Mockery::mock('\\Pheasant\\Database\\Mysqli\\Connection');
        $connection->shouldReceive('execute')->with('BEGIN')->once();
        $connection->shouldReceive('execute')->with('ROLLBACK')->once();
        $transaction = new Transaction($connection);
        $transaction->callback(function () {
            throw new \Exception('Eeeek!');
        });
        $this->setExpectedException('\\Exception');
        $transaction->execute();
    }