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

testCallbacksWithConnectionCalls() public method

    public function testCallbacksWithConnectionCalls()
    {
        $sql = "SELECT * FROM table";
        $connection = \Mockery::mock('\\Pheasant\\Database\\Mysqli\\Connection');
        $connection->shouldReceive('execute')->with('BEGIN')->once();
        $connection->shouldReceive('execute')->with($sql)->once();
        $connection->shouldReceive('execute')->with('COMMIT')->once();
        $transaction = new Transaction($connection);
        $transaction->callback(function () use($connection, $sql) {
            $connection->execute($sql);
        });
        $transaction->execute();
    }