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