Skip to content

Commit

Permalink
Fix tests for PhpUnit 8
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-novotny committed Mar 15, 2020
1 parent ae72daa commit 2740439
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
14 changes: 2 additions & 12 deletions tests/Unit/Balikobot/OrderShipmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ public function testMakeRequestWithDeprecatedParameter()

public function testMakeRequestWithDeprecatedParameterWorks()
{
$depracatedEnabled = Deprecated::$enabled;
Deprecated::$enabled = false;

$requester = $this->newRequesterWithMockedRequestMethod(200, [
'status' => 200,
'order_id' => 29,
Expand All @@ -89,7 +86,7 @@ public function testMakeRequestWithDeprecatedParameterWorks()
$packages->add(new OrderedPackage(1, 'ppl', '0001', '1234'));
$packages->add(new OrderedPackage(2, 'ppl', '0001', '5678'));

$service->orderShipment($packages, new DateTime('2018-10-10 10:00:00'));
@$service->orderShipment($packages, new DateTime('2018-10-10 10:00:00'));

$requester->shouldHaveReceived(
'request',
Expand All @@ -104,8 +101,6 @@ public function testMakeRequestWithDeprecatedParameterWorks()
);

$this->assertTrue(true);

Deprecated::$enabled = $depracatedEnabled;
}

public function testResponseData()
Expand Down Expand Up @@ -138,9 +133,6 @@ public function testResponseData()

public function testResponseDataWithDepractedParameter()
{
$depracatedEnabled = Deprecated::$enabled;
Deprecated::$enabled = false;

$requester = $this->newRequesterWithMockedRequestMethod(200, [
'status' => 200,
'order_id' => 29,
Expand All @@ -157,7 +149,7 @@ public function testResponseDataWithDepractedParameter()
$packages->add(new OrderedPackage(1, 'ppl', '0001', '1234'));
$packages->add(new OrderedPackage(2, 'ppl', '0001', '5678'));

$orderedShipment = $service->orderShipment($packages, new DateTime('2018-10-10 10:00:00'));
@$orderedShipment = $service->orderShipment($packages, new DateTime('2018-10-10 10:00:00'));

$this->assertEquals('ppl', $orderedShipment->getShipper());
$this->assertEquals([1, 2], $orderedShipment->getPackageIds());
Expand All @@ -166,7 +158,5 @@ public function testResponseDataWithDepractedParameter()
$this->assertEquals('http://pdf.balikobot.cz/cp/eNoz0jW0XDBcMAHtXDDJ', $orderedShipment->getLabelsUrl());
$this->assertEquals('http://pdf.balikobot.cz/cp/eNoz0jW0BfwwAe5cMMo.', $orderedShipment->getHandoverUrl());
$this->assertEquals(29, $orderedShipment->getOrderId());

Deprecated::$enabled = $depracatedEnabled;
}
}
7 changes: 1 addition & 6 deletions tests/Unit/Client/Requests/OrderRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,13 @@ public function testMakeRequestWithDeprecatedParameters()

public function testMakeRequestWithDeprecatedParametersWorks()
{
$depracatedEnabled = Deprecated::$enabled;
Deprecated::$enabled = false;

$requester = $this->newRequesterWithMockedRequestMethod(200, [
'status' => 200,
]);

$client = new Client($requester);

$client->orderShipment('cp', [1, 4], new DateTime('2018-10-10 14:00:00'), 'TEST');
@$client->orderShipment('cp', [1, 4], new DateTime('2018-10-10 14:00:00'), 'TEST');

$requester->shouldHaveReceived(
'request',
Expand All @@ -111,8 +108,6 @@ public function testMakeRequestWithDeprecatedParametersWorks()
);

$this->assertTrue(true);

Deprecated::$enabled = $depracatedEnabled;
}

public function testOnlyOrderDataAreReturned()
Expand Down

0 comments on commit 2740439

Please sign in to comment.