|
31 | 31 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Document\DummyOffer as DummyOfferDocument; |
32 | 32 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Document\DummyProduct as DummyProductDocument; |
33 | 33 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Document\DummyProperty as DummyPropertyDocument; |
| 34 | +use ApiPlatform\Core\Tests\Fixtures\TestBundle\Document\DummyTableInheritanceNotApiResourceChild as DummyTableInheritanceNotApiResourceChildDocument; |
34 | 35 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Document\EmbeddableDummy as EmbeddableDummyDocument; |
35 | 36 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Document\EmbeddedDummy as EmbeddedDummyDocument; |
36 | 37 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Document\FileConfigDummy as FileConfigDummyDocument; |
|
74 | 75 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyOffer; |
75 | 76 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyProduct; |
76 | 77 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyProperty; |
| 78 | +use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\DummyTableInheritanceNotApiResourceChild; |
77 | 79 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\EmbeddableDummy; |
78 | 80 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\EmbeddedDummy; |
79 | 81 | use ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\FileConfigDummy; |
@@ -165,6 +167,17 @@ public function thereAreDummyObjects(int $nb) |
165 | 167 | $this->manager->flush(); |
166 | 168 | } |
167 | 169 |
|
| 170 | + /** |
| 171 | + * @When some dummy table inheritance data but not api resource child are created |
| 172 | + */ |
| 173 | + public function someDummyTableInheritanceDataButNotApiResourceChildAreCreated() |
| 174 | + { |
| 175 | + $dummy = $this->buildDummyTableInheritanceNotApiResourceChild(); |
| 176 | + $dummy->setName('Foobarbaz inheritance'); |
| 177 | + $this->manager->persist($dummy); |
| 178 | + $this->manager->flush(); |
| 179 | + } |
| 180 | + |
168 | 181 | /** |
169 | 182 | * @Given there are :nb foo objects with fake names |
170 | 183 | */ |
@@ -1272,6 +1285,14 @@ private function buildDummy() |
1272 | 1285 | return $this->isOrm() ? new Dummy() : new DummyDocument(); |
1273 | 1286 | } |
1274 | 1287 |
|
| 1288 | + /** |
| 1289 | + * @return DummyTableInheritanceNotApiResourceChild|DummyTableInheritanceNotApiResourceChildDocument |
| 1290 | + */ |
| 1291 | + private function buildDummyTableInheritanceNotApiResourceChild() |
| 1292 | + { |
| 1293 | + return $this->isOrm() ? new DummyTableInheritanceNotApiResourceChild() : new DummyTableInheritanceNotApiResourceChildDocument(); |
| 1294 | + } |
| 1295 | + |
1275 | 1296 | /** |
1276 | 1297 | * @return DummyAggregateOffer|DummyAggregateOfferDocument |
1277 | 1298 | */ |
@@ -1540,4 +1561,44 @@ public function testEagerLoadingNotDuplicateRelation() |
1540 | 1561 | $this->manager->flush(); |
1541 | 1562 | $this->manager->clear(); |
1542 | 1563 | } |
| 1564 | + |
| 1565 | + /** |
| 1566 | + * @Given there are :nb sites with internal owner |
| 1567 | + */ |
| 1568 | + public function thereAreSitesWithInternalOwner(int $nb) |
| 1569 | + { |
| 1570 | + for ($i = 1; $i <= $nb; ++$i) { |
| 1571 | + $internalUser = new \ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\InternalUser(); |
| 1572 | + $internalUser->setFirstname('Internal'); |
| 1573 | + $internalUser->setLastname('User'); |
| 1574 | + $internalUser-> setEmail( '[email protected]'); |
| 1575 | + $internalUser->setInternalId('INT'); |
| 1576 | + $site = new \ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Site(); |
| 1577 | + $site->setTitle('title'); |
| 1578 | + $site->setDescription('description'); |
| 1579 | + $site->setOwner($internalUser); |
| 1580 | + $this->manager->persist($site); |
| 1581 | + } |
| 1582 | + $this->manager->flush(); |
| 1583 | + } |
| 1584 | + |
| 1585 | + /** |
| 1586 | + * @Given there are :nb sites with external owner |
| 1587 | + */ |
| 1588 | + public function thereAreSitesWithExternalOwner(int $nb) |
| 1589 | + { |
| 1590 | + for ($i = 1; $i <= $nb; ++$i) { |
| 1591 | + $externalUser = new \ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\ExternalUser(); |
| 1592 | + $externalUser->setFirstname('External'); |
| 1593 | + $externalUser->setLastname('User'); |
| 1594 | + $externalUser-> setEmail( '[email protected]'); |
| 1595 | + $externalUser->setExternalId('EXT'); |
| 1596 | + $site = new \ApiPlatform\Core\Tests\Fixtures\TestBundle\Entity\Site(); |
| 1597 | + $site->setTitle('title'); |
| 1598 | + $site->setDescription('description'); |
| 1599 | + $site->setOwner($externalUser); |
| 1600 | + $this->manager->persist($site); |
| 1601 | + } |
| 1602 | + $this->manager->flush(); |
| 1603 | + } |
1543 | 1604 | } |
0 commit comments