/** * Test commit. * * @param Operation $operation * The operation to perform tests on. * * @dataProvider operationDataProvider */ public function testCommit(Operation $operation) { $performed = false; $callback = function () use(&$performed) { $performed = true; return 'performed'; }; $operation->onCommit($callback); $check = $operation->getCommitCallbacks(); $this->assertSame($callback, reset($check), 'Correct callback was not set.'); $operation->commit(); $this->assertTrue($performed, 'Callback was not executed.'); $check = $operation->getResult(); $this->assertSame('performed', $check, 'Callback did not return proper result.'); }