| Server IP : 77.68.25.176 / Your IP : 216.73.216.24 Web Server : Apache System : Linux plesk 4.15.0-159-generic #167-Ubuntu SMP Tue Sep 21 08:55:05 UTC 2021 x86_64 User : dwp ( 10001) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/dazzlingwebplanet.co.uk/rightway.dazzlingwebplanet.com/tests/APIs/ |
Upload File : |
<?php namespace Tests\APIs;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Tests\TestCase;
use Tests\ApiTestTrait;
use App\Models\Blocks;
class BlocksApiTest extends TestCase
{
use ApiTestTrait, WithoutMiddleware, DatabaseTransactions;
/**
* @test
*/
public function test_create_blocks()
{
$blocks = factory(Blocks::class)->make()->toArray();
$this->response = $this->json(
'POST',
'/api/blocks', $blocks
);
$this->assertApiResponse($blocks);
}
/**
* @test
*/
public function test_read_blocks()
{
$blocks = factory(Blocks::class)->create();
$this->response = $this->json(
'GET',
'/api/blocks/'.$blocks->id
);
$this->assertApiResponse($blocks->toArray());
}
/**
* @test
*/
public function test_update_blocks()
{
$blocks = factory(Blocks::class)->create();
$editedBlocks = factory(Blocks::class)->make()->toArray();
$this->response = $this->json(
'PUT',
'/api/blocks/'.$blocks->id,
$editedBlocks
);
$this->assertApiResponse($editedBlocks);
}
/**
* @test
*/
public function test_delete_blocks()
{
$blocks = factory(Blocks::class)->create();
$this->response = $this->json(
'DELETE',
'/api/blocks/'.$blocks->id
);
$this->assertApiSuccess();
$this->response = $this->json(
'GET',
'/api/blocks/'.$blocks->id
);
$this->response->assertStatus(404);
}
}