Skip to content

Instantly share code, notes, and snippets.

@jtelesforoantonio
Created April 20, 2020 20:55
Show Gist options
  • Save jtelesforoantonio/2d819fa32aedde76e8bcdd03725d18cd to your computer and use it in GitHub Desktop.
Save jtelesforoantonio/2d819fa32aedde76e8bcdd03725d18cd to your computer and use it in GitHub Desktop.
Test Interfaces REST API with Laravel
<?php
namespace Tests\Feature\Contracts;
interface DeleteTestInterface
{
/**
* Unauthorized to delete an item.
*
* @return void
*/
public function testDeleteUnauthorized(): void;
/**
* Forbidden to delete an item.
*
* @return void
*/
public function testDeleteForbidden(): void;
/**
* Item not found .
*
* @return void
*/
public function testDeleteNotFound(): void;
/**
* Successfully to delete an item.
*
* @return void
*/
public function testDeleteSuccess(): void;
}
<?php
namespace Tests\Feature\Contracts;
interface IndexTestInterface
{
/**
* Unauthorized to get index.
*
* @return void
*/
public function testIndexUnauthorized(): void;
/**
* Forbidden to get index.
*
* @return void
*/
public function testIndexForbidden(): void;
/**
* Successfully to get index.
*
* @return void
*/
public function testIndexSuccess(): void;
}
<?php
namespace Tests\Feature\Contracts;
interface PostTestInterface
{
/**
* Unauthorized to create an item.
*
* @return void
*/
public function testPostUnauthorized(): void;
/**
* Forbidden to create an item.
*
* @return void
*/
public function testPostForbidden(): void;
/**
* Fields required.
*
* @return void
*/
public function testPostFieldsRequired(): void;
/**
* Successfully to create an item.
*
* @return void
*/
public function testPostSuccess(): void;
}
<?php
namespace Tests\Feature\Contracts;
interface ShowTestInterface
{
/**
* Unauthorized to get an item.
*
* @return void
*/
public function testShowUnauthorized(): void;
/**
* Forbidden to get an item.
*
* @return void
*/
public function testShowForbidden(): void;
/**
* Item not found.
*
* @return void
*/
public function testShowNotFound():void;
/**
* Successfully to get an item.
*
* @return void
*/
public function testShowSuccess(): void;
}
<?php
namespace Tests\Feature\Contracts;
interface UpdateTestInterface
{
/**
* Unauthorized to update an item.
*
* @return void
*/
public function testUpdateUnauthorized(): void;
/**
* Forbidden to update an item.
*
* @return void
*/
public function testUpdateForbidden(): void;
/**
* Fields required.
*
* @return void
*/
public function testUpdateFieldsRequired(): void;
/**
* Successfully to update an item.
*
* @return void
*/
public function testUpdateSuccess(): void;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment