Skip to content

Commit

Permalink
Extracted EntityStub from FactoryBuilderTest
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Oct 28, 2024
1 parent 8bff1c6 commit 0660369
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 27 deletions.
32 changes: 32 additions & 0 deletions tests/Assets/Testing/EntityStub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace LaravelDoctrineTest\ORM\Assets\Testing;

use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\JoinTable;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToMany;
use Doctrine\ORM\Mapping\InverseJoinColumn;

#[Entity]
class EntityStub
{
#[Id]
#[GeneratedValue]
#[Column(type: "integer")]
public $id;

#[Column(type: "string")]
public $name;

#[ManyToMany(targetEntity: "EntityStub")]
#[JoinTable(name: "stub_stubs")]
#[JoinColumn(name: "owner_id", referencedColumnName: "id")]
#[InverseJoinColumn(name: "owned_id", referencedColumnName: "id")]
public $others;
}
28 changes: 1 addition & 27 deletions tests/Feature/Testing/FactoryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Doctrine\Persistence\ManagerRegistry;
use Faker;
use LaravelDoctrine\ORM\Testing\FactoryBuilder;
use LaravelDoctrineTest\ORM\Assets\Testing\EntityStub;
use LaravelDoctrineTest\ORM\MockeryTestCase;

class FactoryBuilderTest extends MockeryTestCase
Expand Down Expand Up @@ -268,30 +269,3 @@ public function test_it_handles_after_making_with_state_callback()
$this->assertTrue($afterMakingRan);
}
}

use Doctrine\ORM\Mapping\Entity;
use Doctrine\ORM\Mapping\Id;
use Doctrine\ORM\Mapping\GeneratedValue;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\JoinTable;
use Doctrine\ORM\Mapping\JoinColumn;
use Doctrine\ORM\Mapping\ManyToMany;
use Doctrine\ORM\Mapping\InverseJoinColumn;

#[Entity]
class EntityStub
{
#[Id]
#[GeneratedValue]
#[Column(type: "integer")]
public $id;

#[Column(type: "string")]
public $name;

#[ManyToMany(targetEntity: "EntityStub")]
#[JoinTable(name: "stub_stubs")]
#[JoinColumn(name: "owner_id", referencedColumnName: "id")]
#[InverseJoinColumn(name: "owned_id", referencedColumnName: "id")]
public $others;
}

0 comments on commit 0660369

Please sign in to comment.