-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
use Dystcz\LunarApi\Domain\Brands\Models\Brand; | ||
use Dystcz\LunarApi\Domain\Customers\Models\Customer; | ||
use Dystcz\LunarApi\Tests\Stubs\Users\User; | ||
use Dystcz\LunarApi\Tests\TestCase; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
|
||
uses(TestCase::class, RefreshDatabase::class); | ||
|
||
beforeEach(function () { | ||
/** @var TestCase $this */ | ||
$this->user = User::factory() | ||
->has(Customer::factory()) | ||
->create(); | ||
}); | ||
|
||
test('brands cannot be deleted', function () { | ||
/** @var TestCase $this */ | ||
$response = $this->deleteTest('brands', Brand::class); | ||
|
||
$response->assertErrorStatus([ | ||
'status' => '405', | ||
'title' => 'Method Not Allowed', | ||
]); | ||
})->group('brands', 'policies'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
use Dystcz\LunarApi\Domain\Carts\Models\Cart; | ||
use Dystcz\LunarApi\Domain\Customers\Models\Customer; | ||
use Dystcz\LunarApi\Tests\Stubs\Users\User; | ||
use Dystcz\LunarApi\Tests\TestCase; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
|
||
uses(TestCase::class, RefreshDatabase::class); | ||
|
||
beforeEach(function () { | ||
/** @var TestCase $this */ | ||
$this->user = User::factory() | ||
->has(Customer::factory()) | ||
->create(); | ||
}); | ||
|
||
test('carts cannot be deleted', function () { | ||
/** @var TestCase $this */ | ||
$response = $this->deleteTest('carts', Cart::class); | ||
|
||
$response->assertErrorStatus([ | ||
'status' => '405', | ||
'title' => 'Method Not Allowed', | ||
]); | ||
})->group('carts', 'policies'); |
31 changes: 31 additions & 0 deletions
31
tests/Feature/Domain/CartAddresses/DeleteCartAddressTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use Dystcz\LunarApi\Domain\CartAddresses\Models\CartAddress; | ||
use Dystcz\LunarApi\Domain\Carts\Models\Cart; | ||
use Dystcz\LunarApi\Domain\Customers\Models\Customer; | ||
use Dystcz\LunarApi\Tests\Stubs\Users\User; | ||
use Dystcz\LunarApi\Tests\TestCase; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
|
||
uses(TestCase::class, RefreshDatabase::class); | ||
|
||
beforeEach(function () { | ||
/** @var TestCase $this */ | ||
$this->user = User::factory() | ||
->has(Customer::factory()) | ||
->create(); | ||
|
||
$this->cart = Cart::factory()->create(); | ||
|
||
$this->cartAddress = CartAddress::factory()->for($this->cart)->create(); | ||
}); | ||
|
||
test('cart addresses cannot be deleted', function () { | ||
/** @var TestCase $this */ | ||
$response = $this->deleteTest('cart-addresses', $this->cartAddress); | ||
|
||
$response->assertErrorStatus([ | ||
'status' => '405', | ||
'title' => 'Method Not Allowed', | ||
]); | ||
})->group('cart-addresses', 'policies'); |