mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-03 09:44:41 +02:00
Refactored TwigExtensions Part 1
This commit is contained in:
parent
8e6300079a
commit
b078389381
21 changed files with 301 additions and 89 deletions
53
tests/Twig/EntityExtensionTest.php
Normal file
53
tests/Twig/EntityExtensionTest.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace App\Tests\Twig;
|
||||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Devices\Device;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\Storelocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Twig\EntityExtension;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
|
||||
class EntityExtensionTest extends WebTestCase
|
||||
{
|
||||
/** @var EntityExtension */
|
||||
protected $service;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp(); // TODO: Change the autogenerated stub
|
||||
|
||||
//Get an service instance.
|
||||
self::bootKernel();
|
||||
$this->service = self::getContainer()->get(EntityExtension::class);
|
||||
}
|
||||
|
||||
public function testGetEntityType()
|
||||
{
|
||||
$this->assertEquals('part', $this->service->getEntityType(new Part()));
|
||||
$this->assertEquals('footprint', $this->service->getEntityType(new Footprint()));
|
||||
$this->assertEquals('storelocation', $this->service->getEntityType(new Storelocation()));
|
||||
$this->assertEquals('manufacturer', $this->service->getEntityType(new Manufacturer()));
|
||||
$this->assertEquals('category', $this->service->getEntityType(new Category()));
|
||||
$this->assertEquals('device', $this->service->getEntityType(new Device()));
|
||||
$this->assertEquals('attachment', $this->service->getEntityType(new PartAttachment()));
|
||||
$this->assertEquals('supplier', $this->service->getEntityType(new Supplier()));
|
||||
$this->assertEquals('user', $this->service->getEntityType(new User()));
|
||||
$this->assertEquals('group', $this->service->getEntityType(new Group()));
|
||||
$this->assertEquals('currency', $this->service->getEntityType(new Currency()));
|
||||
$this->assertEquals('measurement_unit', $this->service->getEntityType(new MeasurementUnit()));
|
||||
$this->assertEquals('label_profile', $this->service->getEntityType(new LabelProfile()));
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue