Files
2024-01-25 12:54:01 +01:00

41 lines
1.5 KiB
PHP

<?php
/*
* This file has been created by developers from BitBag.
* Feel free to contact us once you face any issues or want to start
* You can find more information about us on https://bitbag.io and write us
* an email on hello@bitbag.io.
*/
declare(strict_types=1);
namespace Tests\BitBag\OpenMarketplace\Integration\Repository;
use ApiTestCase\JsonApiTestCase;
use BitBag\OpenMarketplace\Component\ProductListing\Entity\DraftAttribute;
use BitBag\OpenMarketplace\Component\Vendor\Entity\Vendor;
final class DraftAttributeRepositoryTest extends JsonApiTestCase
{
public function setUp(): void
{
parent::setUp();
$this->entityManager = $this->getContainer()->get('doctrine.orm.entity_manager');
$this->repository = $this->entityManager->getRepository(DraftAttribute::class);
}
public function test_it_finds_all_draft_attributes_for_given_vendor(): void
{
$this->loadFixturesFromFile('DraftAttributeRepositoryTest/test_it_finds_all_draft_attributes_for_given_vendor.yaml');
$vendorOliver = $this->getEntityManager()->getRepository(Vendor::class)->findOneBy(['slug' => 'oliver-queen-company']);
$vendorBruce = $this->getEntityManager()->getRepository(Vendor::class)->findOneBy(['slug' => 'bruce-wayne-company']);
$oliversAttributes = $this->repository->findVendorDraftAttributes($vendorOliver);
$brucesAttributes = $this->repository->findVendorDraftAttributes($vendorBruce);
self::assertCount(2, $oliversAttributes);
self::assertCount(1, $brucesAttributes);
}
}