Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
driskell committed Sep 8, 2020
1 parent ebf5b7b commit f095efb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions tests/unit/CopyRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,20 @@ public function testDestruct()
$tmpfile = tempnam(sys_get_temp_dir(), 'composer_unit_test_');

$req = new CopyRequest('http://example.com/', $tmpfile, false, $this->iop->reveal(), $this->configp->reveal());
$req->getCurlOptions();
$req->makeSuccess();
$this->assertFileExists($tmpfile);

// if $req->success === true ...
$req->makeSuccess();
// if $req->success === true (default, or on success) ...
unset($req);

// then tmpfile remain
$this->assertFileExists($tmpfile);
unlink($tmpfile);

$req = new CopyRequest('http://example.com/', $tmpfile, false, $this->iop->reveal(), $this->configp->reveal());
// if $req->success === false (default) ...
// $req->makeSuccess();
// if $req->success === false (flagged when download starts) ...
$req->getCurlOptions();
unset($req);

// then cleaned tmpfile automatically
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/PrefetcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testFetchAllOnFailure()
CURLOPT_URL => 'file://uso800.txt',
CURLOPT_FILE => tmpfile(),
));

$this->iop->writeError(arg::containingString("<warning>37: Couldn't open file /uso800.txt</warning>"), true, IOInterface::NORMAL)->shouldBeCalledTimes(1);
$this->iop->writeError(" Finished: <comment>success: 0, skipped: 0, failure: 1, total: 1</comment>", true, IOInterface::NORMAL)->shouldBeCalledTimes(1);

Expand Down

0 comments on commit f095efb

Please sign in to comment.