Skip to content

Commit

Permalink
Added test for big contents in response
Browse files Browse the repository at this point in the history
  • Loading branch information
mcustiel committed Jan 24, 2018
1 parent 8589023 commit 266c396
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/tests/_data/dump.sql

This file was deleted.

Binary file added tests/tests/_data/fixtures/Sparkles-12543.mp4
Binary file not shown.
16 changes: 16 additions & 0 deletions tests/tests/acceptance/BasicTestCest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php


use Codeception\Configuration;
use Mcustiel\Phiremock\Client\Phiremock;
use Mcustiel\Phiremock\Client\Utils\A;
use Mcustiel\Phiremock\Client\Utils\Is;
Expand Down Expand Up @@ -76,4 +77,19 @@ public function severalExceptatationsInOneTest(AcceptanceTester $I)
$I->didNotReceiveRequestsInRemoteService();
$I->seeRemoteServiceReceived(0, A::getRequest());
}

public function shouldCreateAnExpectationWithBinaryResponseTest(AcceptanceTester $I)
{
$responseContents = file_get_contents(Configuration::dataDir() . '/fixtures/Sparkles-12543.mp4');
$I->expectARequestToRemoteServiceWithAResponse(
Phiremock::on(
A::getRequest()->andUrl(Is::equalTo('/show-me-the-video'))
)->then(
Respond::withStatusCode(200)->andBinaryBody($responseContents)
)
);

$responseBody = file_get_contents('http://localhost:18080/show-me-the-video');
$I->assertEquals($responseContents, $responseBody);
}
}

0 comments on commit 266c396

Please sign in to comment.