Permalink
Browse files

ShippingService method injection的單元測試

  • Loading branch information...
oomusou committed Apr 17, 2016
1 parent be1a984 commit ebb25ee69a994070c4781415ebe8663d994b64e7
Showing with 3 additions and 21 deletions.
  1. +3 −21 tests/Services/ShippingServiceTest.php
@@ -21,28 +21,10 @@ public function 黑貓單元測試()
App::instance(LogisticsInterface::class, $mock);
$target = App::make(ShippingService::class);
/** act */
$actual = $target->calculateFee($weight);
/** assert */
$this->assertEquals($expected, $actual);
}
/** @test */
public function 黑貓整合測試()
{
/** arrange */
$expected = 110;
$weight = 1;
App::bind(LogisticsInterface::class, BlackCat::class);
$target = App::make(ShippingService::class);
/** act */
$actual = $target->calculateFee($weight);
$actual = App::call(ShippingService::class . '@calculateFee', [
'weight' => $weight
]);
/** assert */
$this->assertEquals($expected, $actual);

0 comments on commit ebb25ee

Please sign in to comment.