update downstream tests for text user requirement
Text now requires a User on construction. seed a user in each test setUp that creates a Text directly or through the fake repository so the suite remains green.
This commit is contained in:
parent
40fdf25da2
commit
cbbbc80326
9 changed files with 71 additions and 22 deletions
|
|
@ -8,10 +8,13 @@ use App\Node\Node;
|
|||
use App\Node\UseCases\BulkCreateNodes;
|
||||
use App\Node\UseCases\BulkCreateNodesRequest;
|
||||
use App\Text\CreateTextDto;
|
||||
use App\User\UseCases\CreateUserDto;
|
||||
use App\ValueObjects\EmailAddress;
|
||||
use DomainException;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tests\Fakes\FakeNodeRepository;
|
||||
use Tests\Fakes\FakeTextRepository;
|
||||
use Tests\Fakes\FakeUserRepository;
|
||||
|
||||
class BulkCreateNodesTest extends TestCase
|
||||
{
|
||||
|
|
@ -22,8 +25,14 @@ class BulkCreateNodesTest extends TestCase
|
|||
|
||||
public function setUp(): void
|
||||
{
|
||||
$userRepo = new FakeUserRepository();
|
||||
$user = $userRepo->create(new CreateUserDto(
|
||||
email: new EmailAddress('a@b.com'),
|
||||
passwordHash: '',
|
||||
isAdmin: false,
|
||||
));
|
||||
$this->textRepo = new FakeTextRepository();
|
||||
$this->textRepo->create(new CreateTextDto(name: 'text'));
|
||||
$this->textRepo->create(new CreateTextDto(name: 'text', user: $user));
|
||||
|
||||
$this->nodeRepo = new FakeNodeRepository();
|
||||
$text = $this->textRepo->find(0);
|
||||
|
|
|
|||
|
|
@ -9,10 +9,13 @@ use App\Node\UseCases\CreateNode;
|
|||
use App\Node\UseCases\CreateNodeRequest;
|
||||
use App\Text\CreateTextDto;
|
||||
use App\Text\Text;
|
||||
use App\User\UseCases\CreateUserDto;
|
||||
use App\ValueObjects\EmailAddress;
|
||||
use DomainException;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Tests\Fakes\FakeNodeRepository;
|
||||
use Tests\Fakes\FakeTextRepository;
|
||||
use Tests\Fakes\FakeUserRepository;
|
||||
|
||||
class CreateNodeTest extends TestCase
|
||||
{
|
||||
|
|
@ -22,9 +25,16 @@ class CreateNodeTest extends TestCase
|
|||
|
||||
public function setUp(): void
|
||||
{
|
||||
$userRepo = new FakeUserRepository();
|
||||
$user = $userRepo->create(new CreateUserDto(
|
||||
email: new EmailAddress('a@b.com'),
|
||||
passwordHash: '',
|
||||
isAdmin: false,
|
||||
));
|
||||
$this->textRepo = new FakeTextRepository();
|
||||
$this->textRepo->create(new CreateTextDto(
|
||||
name: 'text'
|
||||
name: 'text',
|
||||
user: $user,
|
||||
));
|
||||
$this->nodeRepo = new FakeNodeRepository();
|
||||
$this->useCase = new CreateNode(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue