test: annotate Pest closures using $this with \Tests\TestCase
This commit is contained in:
parent
ae520d543d
commit
d29561fe64
15 changed files with 40 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ use Illuminate\Support\Facades\View;
|
|||
|
||||
describe('BasketController', function () {
|
||||
it('can access post /ajax/basket/add', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -25,6 +26,7 @@ describe('BasketController', function () {
|
|||
});
|
||||
|
||||
it('can access post /ajax/basket/empty', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -41,6 +43,7 @@ describe('BasketController', function () {
|
|||
});
|
||||
|
||||
it('can access get /ajax/basket/get', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -57,6 +60,7 @@ describe('BasketController', function () {
|
|||
});
|
||||
|
||||
it('can access post /ajax/basket/remove', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Illuminate\Support\Facades\View;
|
|||
|
||||
describe('PickupController', function () {
|
||||
it('can access get /ajax/shops/1/pickup-timeslots', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Illuminate\Support\Facades\View;
|
|||
|
||||
describe('ForgotPasswordController', function () {
|
||||
it('can access get /auth/mot-de-passe-oublie', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -25,6 +26,7 @@ describe('ForgotPasswordController', function () {
|
|||
});
|
||||
|
||||
it('can access post /auth/mot-de-passe-oublie', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Illuminate\Support\Facades\View;
|
|||
|
||||
describe('RegisterController', function () {
|
||||
it('can access get /auth/inscription', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -25,6 +26,7 @@ describe('RegisterController', function () {
|
|||
});
|
||||
|
||||
it('can access post /auth/inscription', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Illuminate\Support\Facades\View;
|
|||
|
||||
describe('ResetPasswordController', function () {
|
||||
it('can access get /auth/reinitialiser-mdp/1', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -25,6 +26,7 @@ describe('ResetPasswordController', function () {
|
|||
});
|
||||
|
||||
it('can access post /auth/reinitialiser-mdp/1', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Illuminate\Support\Facades\View;
|
|||
|
||||
describe('VerificationController', function () {
|
||||
it('can access post /auth/email/resend', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -25,6 +26,7 @@ describe('VerificationController', function () {
|
|||
});
|
||||
|
||||
it('can access get /auth/email/verify', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -41,6 +43,7 @@ describe('VerificationController', function () {
|
|||
});
|
||||
|
||||
it('can access get /auth/email/verify/1/1', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Illuminate\Support\Facades\View;
|
|||
|
||||
describe('PageController', function () {
|
||||
it('can access get /cgv', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -25,6 +26,7 @@ describe('PageController', function () {
|
|||
});
|
||||
|
||||
it('can access get /charte-de-confidentialite', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -41,6 +43,7 @@ describe('PageController', function () {
|
|||
});
|
||||
|
||||
it('can access get /faq', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
@ -57,6 +60,7 @@ describe('PageController', function () {
|
|||
});
|
||||
|
||||
it('can access get /mentions-legales', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
View::share('PageList', Page::getCached()
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use Illuminate\Support\Facades\View;
|
|||
|
||||
describe('ProductsController', function () {
|
||||
it('can access get /produits', function () {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$this->seed(ContentSeeder::class);
|
||||
$pages = Page::getCached()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
it('Should required login to access backoffice', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$route = route('bo.dashboard');
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Date;
|
|||
describe('On Slide CRUD', function (): void {
|
||||
|
||||
it('Can create a slide', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
$this->withoutExceptionHandling();
|
||||
// GIVEN
|
||||
$htmlDateInputFormat = 'Y-m-d\TH:i';
|
||||
|
|
@ -35,6 +36,7 @@ describe('On Slide CRUD', function (): void {
|
|||
});
|
||||
|
||||
it('Can edit a slide', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$user = User::factory()->createOne();
|
||||
$slide = Slide::factory()->createOne();
|
||||
|
|
@ -48,6 +50,7 @@ describe('On Slide CRUD', function (): void {
|
|||
});
|
||||
|
||||
it('Can update a slide', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
$this->withoutExceptionHandling();
|
||||
// GIVEN
|
||||
$user = User::factory()->createOne();
|
||||
|
|
@ -71,6 +74,7 @@ describe('On Slide CRUD', function (): void {
|
|||
});
|
||||
|
||||
it('Can delete a slide', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$user = User::factory()->createOne();
|
||||
$slide = Slide::factory()->createOne();
|
||||
|
|
@ -84,6 +88,7 @@ describe('On Slide CRUD', function (): void {
|
|||
});
|
||||
|
||||
it('Can update a slide order', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$user = User::factory()->createOne();
|
||||
$slide = Slide::factory()->createOne();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ use App\Models\User;
|
|||
describe('On Tag CRUD', function (): void {
|
||||
|
||||
it('Can create a tag', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
$this->withoutExceptionHandling();
|
||||
// GIVEN
|
||||
$user = User::factory()->createOne();
|
||||
|
|
@ -30,6 +31,7 @@ describe('On Tag CRUD', function (): void {
|
|||
});
|
||||
|
||||
it('Can edit a tag', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$user = User::factory()->createOne();
|
||||
$tag = Tag::factory()->createOne();
|
||||
|
|
@ -43,6 +45,7 @@ describe('On Tag CRUD', function (): void {
|
|||
});
|
||||
|
||||
it('Can update a tag', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
$this->withoutExceptionHandling();
|
||||
// GIVEN
|
||||
$user = User::factory()->createOne();
|
||||
|
|
@ -63,6 +66,7 @@ describe('On Tag CRUD', function (): void {
|
|||
});
|
||||
|
||||
it('Can delete a tag', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$user = User::factory()->createOne();
|
||||
$tag = Tag::factory()->createOne();
|
||||
|
|
@ -76,6 +80,7 @@ describe('On Tag CRUD', function (): void {
|
|||
});
|
||||
|
||||
it('Can update a tag order', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$user = User::factory()->createOne();
|
||||
$tag = Tag::factory()->createOne();
|
||||
|
|
@ -100,6 +105,7 @@ describe('On Tag CRUD', function (): void {
|
|||
});
|
||||
|
||||
it('Can toggle a tag status', function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$user = User::factory()->createOne();
|
||||
$tag = Tag::factory()->createOne();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use Money\Money;
|
|||
|
||||
describe('CreateDiscount action', function (): void {
|
||||
beforeEach(function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
$this->range = new Range();
|
||||
$this->range->name = 'Gamme ' . uniqid();
|
||||
$this->range->status = true;
|
||||
|
|
@ -57,6 +58,7 @@ describe('CreateDiscount action', function (): void {
|
|||
};
|
||||
|
||||
it('creates and persists a percent discount in database with associated products', function () use ($createProduct): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$product1 = $createProduct('Produit 1', $this->range);
|
||||
$product2 = $createProduct('Produit 2', $this->range);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use Money\Money;
|
|||
|
||||
describe('DeleteDiscount action', function (): void {
|
||||
beforeEach(function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
$this->range = new Range();
|
||||
$this->range->name = 'Gamme ' . uniqid();
|
||||
$this->range->status = true;
|
||||
|
|
@ -55,6 +56,7 @@ describe('DeleteDiscount action', function (): void {
|
|||
};
|
||||
|
||||
it('deletes a discount and nullifies product discount_id', function () use ($createProduct): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$product = $createProduct('P1', $this->range);
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use Money\Money;
|
|||
|
||||
describe('UpdateDiscount action', function (): void {
|
||||
beforeEach(function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
$this->range = new Range();
|
||||
$this->range->name = 'Gamme ' . uniqid();
|
||||
$this->range->status = true;
|
||||
|
|
@ -56,6 +57,7 @@ describe('UpdateDiscount action', function (): void {
|
|||
};
|
||||
|
||||
it('updates and persists a discount in database with synchronised products', function () use ($createProduct): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$product1 = $createProduct('P1', $this->range);
|
||||
$product2 = $createProduct('P2', $this->range);
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ use Money\Money;
|
|||
|
||||
describe('GetDiscountFormDataQuery', function (): void {
|
||||
beforeEach(function (): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
$this->range = new Range();
|
||||
$this->range->name = 'Gamme ' . uniqid();
|
||||
$this->range->status = true;
|
||||
|
|
@ -57,6 +58,7 @@ describe('GetDiscountFormDataQuery', function (): void {
|
|||
};
|
||||
|
||||
it('returns form data for create mode when discount is null', function () use ($createProduct): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$product1 = $createProduct('Poulet', $this->range);
|
||||
$product2 = $createProduct('Canard', $this->range);
|
||||
|
|
@ -76,6 +78,7 @@ describe('GetDiscountFormDataQuery', function (): void {
|
|||
});
|
||||
|
||||
it('returns form data for edit mode when discount is provided', function () use ($createProduct): void {
|
||||
/** @var \Tests\TestCase $this */
|
||||
// GIVEN
|
||||
$productAssociated = $createProduct('Associe', $this->range);
|
||||
$productNotAssociated = $createProduct('NonAssocie', $this->range);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue