2019-07-16 20:46:38 +02:00
|
|
|
<?php
|
|
|
|
|
2020-06-05 14:19:29 +02:00
|
|
|
namespace Tests\Models;
|
2019-07-16 20:46:38 +02:00
|
|
|
|
|
|
|
use App\Models\Note;
|
|
|
|
use App\Models\User;
|
|
|
|
use App\Repositories\NoteRepository;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class NoteDeleteTest extends TestCase
|
|
|
|
{
|
|
|
|
use DatabaseMigrations;
|
|
|
|
use DatabaseTransactions;
|
|
|
|
|
|
|
|
/** @var User */
|
|
|
|
private $user;
|
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
2020-11-08 20:10:42 +01:00
|
|
|
$this->user = User::factory()->create();
|
2019-07-16 20:46:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testValidCategoryCreation(): void
|
|
|
|
{
|
|
|
|
$this->be($this->user);
|
|
|
|
|
2020-11-08 20:10:42 +01:00
|
|
|
$note = Note::factory()->create();
|
2019-07-16 20:46:38 +02:00
|
|
|
|
2020-06-05 14:19:29 +02:00
|
|
|
$deletionResult = NoteRepository::delete($note);
|
2019-07-16 20:46:38 +02:00
|
|
|
|
2020-06-05 14:19:29 +02:00
|
|
|
$this->assertTrue($deletionResult);
|
2019-07-16 20:46:38 +02:00
|
|
|
}
|
|
|
|
}
|