Permalink
Browse files

[整合測試] ShippingService 使用 closure

  • Loading branch information...
1 parent 9a1347a commit 1303628c3c07cce3cf53572c7ddc1d2b3729bc15 Sam.IO.Hsiao committed Nov 18, 2016
Showing with 19 additions and 0 deletions.
  1. +19 −0 tests/ShippingServiceTest.php
@@ -28,4 +28,23 @@ public function 黑貓單元測試()
$expected = 110;
$this->assertEquals($expected, $actual);
}
+
+ /** @test */
+ public function 黑貓整合測試()
+ {
+ /** arrange */
+
+ /** act */
+ $weight = 1;
+ $actual = App::call(ShippingService::class . '@calculateFee', [
+ 'weight' => $weight,
+ 'logistics' => function (int $weight) {
+ return 100 * $weight + 10;
+ },
+ ]);
+
+ /** assert */
+ $expected = 110;
+ $this->assertEquals($expected, $actual);
+ }
}

0 comments on commit 1303628

Please sign in to comment.