InventoryService_CreateMissionTest.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Tests\Inventory\Services\InventoryService;
  3. use App\Inventory;
  4. use App\InventoryMission;
  5. use App\Services\InventoryService;
  6. use Tests\TestCase;
  7. class InventoryService_CreateMissionTest extends TestCase
  8. {
  9. public $inventory;
  10. public $inventoryMissions;
  11. function setUp(): void
  12. {
  13. parent::setUp(); // TODO: Change the autogenerated stub
  14. }
  15. function testCreateMissionsFail(){
  16. $realService=new InventoryService();
  17. $this->inventory=$realService->createMission('2020-08-20','2020-08-20','');
  18. $this->assertNull($this->inventory);
  19. }
  20. function testCreateMissionsSuccess(){
  21. $realService=new InventoryService();
  22. $this->inventory=$realService->createMission('2020-08-20','2020-08-20',3);
  23. $this->assertIsObject($this->inventory);
  24. $this->assertNotEmpty($this->inventory);
  25. }
  26. function tearDown(): void
  27. {
  28. InventoryMission::where('inventory_id',$this->inventory['id'])->delete();
  29. Inventory::where('id',$this->inventory['id'])->forceDelete();
  30. parent::tearDown(); // TODO: Change the autogenerated stub
  31. }
  32. }