/** * @covers ::setPreprocessCallback * @covers ::getPreprocessCallback */ public function testConfig_setPreprocessCallback() { $callback = '\\SomeNs\\SomeClass::someOtherMethod'; $config = new Config(); $config->setPreprocessCallback($callback); $this->assertSame($callback, $config->getPreprocessCallback()); }
/** * @covers ::save */ public function testFile_save_preProcess() { //// Setup test $this->requestArr['flowTotalChunks'] = 1; $this->requestArr['flowTotalSize'] = 10; $processCalled = false; $process = function ($chunk) use(&$processCalled) { $processCalled = true; }; $this->config->setPreprocessCallback($process); $request = new Request($this->requestArr); $file = new File($this->config, $request); $chunkPrefix = sha1($request->getIdentifier()) . '_'; $chunk = vfsStream::newFile($chunkPrefix . '1', 0777); $chunk->setContent('1234567890'); $this->vfs->addChild($chunk); $filePath = $this->vfs->url() . DIRECTORY_SEPARATOR . 'file'; //// Actual test $this->assertTrue($file->save($filePath)); $this->assertTrue(file_exists($filePath)); $this->assertEquals($request->getTotalSize(), filesize($filePath)); $this->assertTrue($processCalled); }