public function testBigFile() { $requestID = 'TestRequest::testBigFile'; $Request = new Request(self::$_urlBigFile, $requestID); $contentExpectedSize = null; while (true) { try { $Request->setCaching(true, true); $Request->setTimeout(1); $Request->download(); } catch (CurlError $e) { $this->assertEquals(CurlError::E_OPERATION_TIMEDOUT, $e->getCode()); $downloadFilePath = $Request->getDownloadFilePath(true); $contentExpectedSize = $Request->getContentExpectedSize(); unset($Request); $this->assertFileExists($downloadFilePath); $Request = new Request(self::$_urlBigFile, $requestID); continue; } $this->assertTrue($Request->isDownloadSuccess(), 'Error: Request::download method must throw Exception or return success'); break; } $fullFilePath = $Request->getDownloadFilePath(true); $fullStatePath = $Request->getDownloadStateFilePath(true); $this->assertFileExists($fullFilePath); // destructor unset($Request); $this->assertFileExists($fullFilePath); $this->assertTrue(unlink($fullFilePath)); $this->assertTrue(unlink($fullStatePath)); }