From 6685658a89a7f9c5d5a85e40ebb30b6011f4a62f Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 8 Jun 2017 22:48:48 +0200 Subject: [PATCH] Add ZipService tests, Add ApplicationAvailabilityTest --- app/Resources/views/macros/blocks.html.twig | 8 ++- app/Resources/views/set/detail.html.twig | 6 +- app/config/config/fos_elastica.yml | 1 + .../Entity/Rebrickable/Inventory_Part.php | 8 +++ src/AppBundle/Service/SetService.php | 12 ++++ src/AppBundle/Service/ZipService.php | 4 +- .../AppBundle/ApplicationAvailabilityTest.php | 39 ------------ tests/AppBundle/BaseTest.php | 13 ++-- .../ApplicationAvailabilityTest.php | 36 +++++++++++ .../Controller/BaseControllerTest.php | 19 ++++++ .../Controller/DefaultControllerTest.php | 15 ----- tests/AppBundle/Fixtures/LoadBaseData.php | 43 ++++++++++++- tests/AppBundle/Fixtures/models/1.stl | Bin 0 -> 29284 bytes .../Loader/ModelLoader/ModelLoaderTest.php | 4 +- .../fixtures/filecontext/parts/30367a.dat | 0 .../fixtures/filecontext/parts/983.dat | 0 .../fixtures/filecontext/parts/999.dat | 0 .../fixtures/included/parts/1000d01.dat | 0 .../fixtures/included/parts/povray.dat | 0 .../fixtures/librarycontext/parts/30367b.dat | 0 .../fixtures/librarycontext/parts/3820.dat | 0 .../librarycontext/parts/licensed.dat | 0 .../fixtures/license/parts/licensed.dat | 0 .../fixtures/license/parts/unlicensed.dat | 0 .../fixtures/printed/parts/30367b.dat | 0 .../fixtures/printed/parts/30367bps7.dat | 0 .../fixtures/update/version1/parts/3820.dat | 0 .../fixtures/update/version1/parts/500.dat | 0 .../fixtures/update/version1/parts/983.dat | 0 .../fixtures/update/version2/parts/3820.dat | 0 .../fixtures/update/version2/parts/3821.dat | 0 .../fixtures/update/version2/parts/500.dat | 0 .../fixtures/update/version2/parts/983.dat | 0 .../fixtures/update2/version1/parts/3820.dat | 0 .../fixtures/update2/version2/parts/3820.dat | 0 .../Stl/StlConverter/StlConverterTest.php | 12 ++-- .../StlConverter/fixtures/ldraw/p/2-4edge.dat | 0 .../StlConverter/fixtures/ldraw/p/3-4edge.dat | 0 .../StlConverter/fixtures/ldraw/p/4-4edge.dat | 0 .../fixtures/ldraw/parts/3820.dat | 0 .../StlConverter/fixtures/ldraw/parts/983.dat | 0 .../Service/Stl/StlFixer/StlFixerTest.php | 4 +- .../Service/Stl/StlFixer/fixtures/ascii.stl | 0 .../Service/Stl/StlFixer/fixtures/binary.stl | 0 .../Stl/StlRenderer/StlRendererTest.php | 6 +- .../Stl/StlRenderer/fixtures/973c00.png | Bin .../Stl/StlRenderer/fixtures/973c00.stl | Bin .../Stl/StlRenderer/fixtures/layout.tmpl | 52 +++++++++++++++ tests/AppBundle/Service/ZipServiceTest.php | 60 ++++++++++++++++++ .../Transformer/FormatTransformerTest.php | 0 .../Util/LDModelParser/LDModelParserTest.php | 8 +-- .../Util/LDModelParser/fixtures/alias.txt | 0 .../Util/LDModelParser/fixtures/invalid.dat | 0 .../Util/LDModelParser/fixtures/stickers.txt | 0 .../Util/LDModelParser/fixtures/valid.dat | 0 .../RelationMapper/RelationMapperTest.php | 4 +- .../Util/RelationMapper/fixtures/empty.yml | 0 .../Util/RelationMapper/fixtures/invalid.yml | 0 .../RelationMapper/fixtures/resources.yml | 0 tests/Service/ZipServiceTest.php | 10 --- 60 files changed, 270 insertions(+), 94 deletions(-) delete mode 100644 tests/AppBundle/ApplicationAvailabilityTest.php create mode 100644 tests/AppBundle/Controller/ApplicationAvailabilityTest.php create mode 100644 tests/AppBundle/Controller/BaseControllerTest.php delete mode 100644 tests/AppBundle/Controller/DefaultControllerTest.php create mode 100644 tests/AppBundle/Fixtures/models/1.stl rename tests/{ => AppBundle}/Service/Loader/ModelLoader/ModelLoaderTest.php (99%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/filecontext/parts/30367a.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/filecontext/parts/983.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/filecontext/parts/999.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/included/parts/1000d01.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/included/parts/povray.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/librarycontext/parts/30367b.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/librarycontext/parts/3820.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/librarycontext/parts/licensed.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/license/parts/licensed.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/license/parts/unlicensed.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/printed/parts/30367b.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/printed/parts/30367bps7.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/update/version1/parts/3820.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/update/version1/parts/500.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/update/version1/parts/983.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/update/version2/parts/3820.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/update/version2/parts/3821.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/update/version2/parts/500.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/update/version2/parts/983.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/update2/version1/parts/3820.dat (100%) rename tests/{ => AppBundle}/Service/Loader/ModelLoader/fixtures/update2/version2/parts/3820.dat (100%) rename tests/{ => AppBundle}/Service/Stl/StlConverter/StlConverterTest.php (83%) rename tests/{ => AppBundle}/Service/Stl/StlConverter/fixtures/ldraw/p/2-4edge.dat (100%) rename tests/{ => AppBundle}/Service/Stl/StlConverter/fixtures/ldraw/p/3-4edge.dat (100%) rename tests/{ => AppBundle}/Service/Stl/StlConverter/fixtures/ldraw/p/4-4edge.dat (100%) rename tests/{ => AppBundle}/Service/Stl/StlConverter/fixtures/ldraw/parts/3820.dat (100%) rename tests/{ => AppBundle}/Service/Stl/StlConverter/fixtures/ldraw/parts/983.dat (100%) rename tests/{ => AppBundle}/Service/Stl/StlFixer/StlFixerTest.php (91%) rename tests/{ => AppBundle}/Service/Stl/StlFixer/fixtures/ascii.stl (100%) rename tests/{ => AppBundle}/Service/Stl/StlFixer/fixtures/binary.stl (100%) rename tests/{ => AppBundle}/Service/Stl/StlRenderer/StlRendererTest.php (82%) rename tests/{ => AppBundle}/Service/Stl/StlRenderer/fixtures/973c00.png (100%) rename tests/{ => AppBundle}/Service/Stl/StlRenderer/fixtures/973c00.stl (100%) create mode 100644 tests/AppBundle/Service/Stl/StlRenderer/fixtures/layout.tmpl create mode 100644 tests/AppBundle/Service/ZipServiceTest.php rename tests/{ => AppBundle}/Transformer/FormatTransformerTest.php (100%) rename tests/{ => AppBundle}/Util/LDModelParser/LDModelParserTest.php (86%) rename tests/{ => AppBundle}/Util/LDModelParser/fixtures/alias.txt (100%) rename tests/{ => AppBundle}/Util/LDModelParser/fixtures/invalid.dat (100%) rename tests/{ => AppBundle}/Util/LDModelParser/fixtures/stickers.txt (100%) rename tests/{ => AppBundle}/Util/LDModelParser/fixtures/valid.dat (100%) rename tests/{ => AppBundle}/Util/RelationMapper/RelationMapperTest.php (89%) rename tests/{ => AppBundle}/Util/RelationMapper/fixtures/empty.yml (100%) rename tests/{ => AppBundle}/Util/RelationMapper/fixtures/invalid.yml (100%) rename tests/{ => AppBundle}/Util/RelationMapper/fixtures/resources.yml (100%) delete mode 100644 tests/Service/ZipServiceTest.php diff --git a/app/Resources/views/macros/blocks.html.twig b/app/Resources/views/macros/blocks.html.twig index 259df4e..8dd852d 100644 --- a/app/Resources/views/macros/blocks.html.twig +++ b/app/Resources/views/macros/blocks.html.twig @@ -33,7 +33,9 @@ {{ model.name }}
- {{ model.category.name }} + {% if model.category is not null %} + {{ model.category.name }} + {% endif %} {% if quantity %}{{ quantity }}x{% endif %}
@@ -71,7 +73,9 @@
{{ set.id }}
- {{ set.theme.fullName }} + {% if set.theme is not null %} + {{ set.theme.fullName }} + {% endif %}
diff --git a/app/Resources/views/set/detail.html.twig b/app/Resources/views/set/detail.html.twig index 8b1e3e8..ef2d630 100644 --- a/app/Resources/views/set/detail.html.twig +++ b/app/Resources/views/set/detail.html.twig @@ -39,7 +39,11 @@ {{ 'set.theme' | trans }} - {{ set.theme ? set.theme.fullName }} + + {% if set.theme is not null %} + {{ set.theme ? set.theme.fullName }} + {% endif %} + {{ 'set.parts' | trans }} diff --git a/app/config/config/fos_elastica.yml b/app/config/config/fos_elastica.yml index 7c5c121..159c29d 100644 --- a/app/config/config/fos_elastica.yml +++ b/app/config/config/fos_elastica.yml @@ -3,6 +3,7 @@ fos_elastica: default: { host: '%elastica_host%', port: '%elastica_port%', logger: true } indexes: app: + index_name: app_%kernel.environment% settings: index: analysis: diff --git a/src/AppBundle/Entity/Rebrickable/Inventory_Part.php b/src/AppBundle/Entity/Rebrickable/Inventory_Part.php index ff5dcc3..631f719 100644 --- a/src/AppBundle/Entity/Rebrickable/Inventory_Part.php +++ b/src/AppBundle/Entity/Rebrickable/Inventory_Part.php @@ -48,6 +48,14 @@ class Inventory_Part */ protected $inventory; + /** + * @param int $quantity + */ + public function setQuantity($quantity) + { + $this->quantity = $quantity; + } + /** * Get count. * diff --git a/src/AppBundle/Service/SetService.php b/src/AppBundle/Service/SetService.php index 2ade955..9ffe24f 100644 --- a/src/AppBundle/Service/SetService.php +++ b/src/AppBundle/Service/SetService.php @@ -35,6 +35,18 @@ class SetService $this->inventorySetRepository = $em->getRepository(Inventory_Set::class); } + /** + * Find set by id + * + * @param $id + * + * @return Set + */ + public function findSet($id) + { + return $this->setRepository->find($id); + } + /** * Get all sets in the set inventory. * diff --git a/src/AppBundle/Service/ZipService.php b/src/AppBundle/Service/ZipService.php index 4aee481..9d2336c 100644 --- a/src/AppBundle/Service/ZipService.php +++ b/src/AppBundle/Service/ZipService.php @@ -117,7 +117,7 @@ class ZipService * @param Set $set * @param bool $spare If true - add only spare parts, false - add only regular parts, null - add all parts */ - public function addSetGroupedByColor(Set $set, $spare = null) + private function addSetGroupedByColor(Set $set, $spare = null) { $colors = $this->setService->getModelsGroupedByColor($set, $spare); @@ -141,7 +141,7 @@ class ZipService * @param Set $set * @param bool $spare If true - add only spare parts, false - add only regular parts, null - add all parts */ - public function addSet(Set $set, $spare = null) + private function addSet(Set $set, $spare = null) { $models = $this->setService->getModels($set, $spare); diff --git a/tests/AppBundle/ApplicationAvailabilityTest.php b/tests/AppBundle/ApplicationAvailabilityTest.php deleted file mode 100644 index 1c72420..0000000 --- a/tests/AppBundle/ApplicationAvailabilityTest.php +++ /dev/null @@ -1,39 +0,0 @@ -setUpDb(); - - $this->loadFixtures([ - LoadBaseData::class - ]); - - parent::setUp(); - } - - /** - * @dataProvider urlProvider - */ - public function testPageIsSuccessful($url) - { - $client = $this->makeClient(); - $client->request('GET', $url); - - $this->assertTrue( $client->getResponse()->isSuccessful()); - } - - public function urlProvider() - { - return array( - array('/'), - array('/models') - ); - } -} \ No newline at end of file diff --git a/tests/AppBundle/BaseTest.php b/tests/AppBundle/BaseTest.php index fc13e8c..0304a9a 100644 --- a/tests/AppBundle/BaseTest.php +++ b/tests/AppBundle/BaseTest.php @@ -13,27 +13,22 @@ use Symfony\Component\HttpKernel\KernelInterface; abstract class BaseTest extends WebTestCase { - protected $_container; - /* @var FilesystemInterface $filesystem */ protected $filesystem; /** @var EntityManagerInterface */ protected $em; - public function __construct() + public function setUp() { - self::bootKernel(); - $this->_container = self::$kernel->getContainer(); $this->filesystem = $this->get('oneup_flysystem.media_filesystem'); $this->em = $this->get('doctrine.orm.entity_manager'); - parent::__construct(); } public function setUpDb() { // Make sure we are in the test environment - if ('test' !== self::$kernel->getEnvironment()) { + if ('test' !== $this->get('kernel')->getEnvironment()) { throw new \LogicException('setUpDb must be executed in the test environment'); } @@ -45,11 +40,11 @@ abstract class BaseTest extends WebTestCase protected function get($service) { - return $this->_container->get($service); + return $this->getContainer()->get($service); } protected function getParameter($parameter) { - return $this->_container->getParameter($parameter); + return $this->getContainer()->getParameter($parameter); } } diff --git a/tests/AppBundle/Controller/ApplicationAvailabilityTest.php b/tests/AppBundle/Controller/ApplicationAvailabilityTest.php new file mode 100644 index 0000000..bab4d08 --- /dev/null +++ b/tests/AppBundle/Controller/ApplicationAvailabilityTest.php @@ -0,0 +1,36 @@ +request('GET', $url); + + $this->assertTrue( $client->getResponse()->isSuccessful()); + } + + public function urlProvider() + { + return array( + array('/'), + array('/colors/'), + array('/bricks/'), + array('/bricks/1'), + array('/bricks/1/sets'), + array('/sets/'), + array('/sets/8049-1'), + array('/sets/8049-1/inventory'), + array('/sets/8049-1/models'), + array('/sets/8049-1/colors'), + array('/parts/1') + ); + } +} \ No newline at end of file diff --git a/tests/AppBundle/Controller/BaseControllerTest.php b/tests/AppBundle/Controller/BaseControllerTest.php new file mode 100644 index 0000000..cd37564 --- /dev/null +++ b/tests/AppBundle/Controller/BaseControllerTest.php @@ -0,0 +1,19 @@ +loadFixtures([ + LoadBaseData::class + ]); + + $this->runCommand('fos:elastica:populate'); + } +} \ No newline at end of file diff --git a/tests/AppBundle/Controller/DefaultControllerTest.php b/tests/AppBundle/Controller/DefaultControllerTest.php deleted file mode 100644 index cf961a4..0000000 --- a/tests/AppBundle/Controller/DefaultControllerTest.php +++ /dev/null @@ -1,15 +0,0 @@ -setName('Author'); + $manager->persist($author); + // Add sample model $model = new Model(); $model->setId(1); $model->setAuthor($author); $model->setModified(new \DateTime()); $model->setName('Name'); - + $model->setPath('models/1.stl'); $manager->persist($model); + // Add sample part + $part = new Part(); + $part->setId(1); + $part->setName('Name'); + $part->setModel($model); + $manager->persist($part); + + $set = new Set(); + $set->setName('Set'); + $set->setId('8049-1'); + $set->setPartCount(1); + $set->setYear(2011); + $manager->persist($set); + + $color = new Color(); + $color->setId(1); + $color->setName('Black'); + $color->setRgb('000000'); + $color->setTransparent(false); + $manager->persist($color); + + $inventory = new Inventory(); + $inventory->setSet($set); + $inventory->setVersion(1); + $manager->persist($inventory); + + $inventoryPart = new Inventory_Part(); + $inventoryPart->setColor($color); + $inventoryPart->setQuantity(5); + $inventoryPart->setPart($part); + $inventoryPart->setInventory($inventory); + $inventoryPart->setSpare(false); + $manager->persist($inventoryPart); + $manager->flush(); } } \ No newline at end of file diff --git a/tests/AppBundle/Fixtures/models/1.stl b/tests/AppBundle/Fixtures/models/1.stl new file mode 100644 index 0000000000000000000000000000000000000000..5c691e7ef9b3c12c7cb929771374635c7f5a65a3 GIT binary patch literal 29284 zcmb82Z>Vi+RmN9A-wJ{or2T+GYMBzv!oB?XxkmYSHB-CL4e^Zy0X@Adq|BF8k83Pr*n*d~_ zWF)>B!xI{V(e^cZ4`n2(HEtfrNRP+uoF1$p2ANBPik#LM9*^7h?&PQr8HtKK`25lt zRF+qI#;D?ho9CYWX6EKbwrX{fF;J&!H8aj`|IWu4J8>iXy=?R*jYXq!1}J@gGLIYy z9v{1G^d^lMM6MrYo@`M19PQJL9@Stdj|Xdb9<7m8IMz_CyLa#2$bRnG-^NZo?0Hl| zHDjQ};PdU~=imRX{rCUJGgp!J=J)TuInlkM6Kn#y`IDOZS}N zDA`2XZe9`b-xNCh%{{V-yV>k6@7(!RYl!jAw}0ZcP_P{(n@>~YTpI3?jmE!y`DKRKN69XYH@yE{7q9JFxkok{PdxFGtYOtkjDLCif8Q30SdNli8b2EvuZfYx z-xl}CRvsVz;48aUV!U)c^Sd9tFBGvH zC7VyTn_yhE#z5f_3JqpfBU~Aw5!aGZ2k$7^e7@bhCDzoVRjYwIWN3xfe2DS2=f9Ne z3UwHclFjGa&AX#cfBDs%k4+s>OV&g-sFyzamdl_1$xrXFSH?46df}N+s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j%?m&kjrMm&EyMJtnYq6lopTQ5*Xu7riILe#y~M1WJsW!Px!a%9-aY z_sE9Pb?Y8ZjNUI9N2jA?mqzS3wTqsSSh!A=o-eG!v=xN)q> zhQT^k-D)=qM(>vlhNFDt55{@yC%(u%&d@rpJbF~@$*`X|jx|Tgo@$lXbN9$5Zr81Q zpRUzK?rq?^}v0oDN@u_i4_)+9%@RiZ~C4=E8*)@aOjf$){?vYKlR3!equFS>g z{gS*EY1V`iV`zAPm9Y*Pe$F3zG8esHG8m4MT^ig!XRnVu+#{Q@`x!jwE8<C_f73D-QR} z<1TKFD(uSx`?^LI+4gJUUzR##B&t837`3l-z(_WENDo`1I?2dUIYXn;o!9!!qZs=% zl4cA&G}imhK3WId8R&KFp`NOjmjFKX6*3Dw#<{Ad9c!# zc=KydSs!CaBS$C=uyb|$-@Zz=+cC=h>G?QBg*G|uoRK>D>r!}{!QJrqx6kt5+TxCN z+NrUCr^1SLh*ExhK4vgEVxW#4A2OO@|KAv`mwAYh;TP&9^^TikcMa?*k3+^Zsz8rg zjX57P*drPBL0dUx=6QBwY#Nm_G(y(^dpPI$@6Yv|uXbEPkN@qnuE~s|(r7p%buQ#N z{5S5D$N0DC7Vz_&mqvW3e<5#-@bsLcjvfrRrEzp-$nlDy5t4@(jHte=FmodelRepository = $this->em->getRepository(Model::class); $this->aliasRepository = $this->em->getRepository(Alias::class); diff --git a/tests/Service/Loader/ModelLoader/fixtures/filecontext/parts/30367a.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/filecontext/parts/30367a.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/filecontext/parts/30367a.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/filecontext/parts/30367a.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/filecontext/parts/983.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/filecontext/parts/983.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/filecontext/parts/983.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/filecontext/parts/983.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/filecontext/parts/999.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/filecontext/parts/999.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/filecontext/parts/999.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/filecontext/parts/999.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/included/parts/1000d01.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/included/parts/1000d01.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/included/parts/1000d01.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/included/parts/1000d01.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/included/parts/povray.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/included/parts/povray.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/included/parts/povray.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/included/parts/povray.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/librarycontext/parts/30367b.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/librarycontext/parts/30367b.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/librarycontext/parts/30367b.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/librarycontext/parts/30367b.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/librarycontext/parts/3820.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/librarycontext/parts/3820.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/librarycontext/parts/3820.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/librarycontext/parts/3820.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/librarycontext/parts/licensed.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/librarycontext/parts/licensed.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/librarycontext/parts/licensed.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/librarycontext/parts/licensed.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/license/parts/licensed.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/license/parts/licensed.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/license/parts/licensed.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/license/parts/licensed.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/license/parts/unlicensed.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/license/parts/unlicensed.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/license/parts/unlicensed.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/license/parts/unlicensed.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/printed/parts/30367b.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/printed/parts/30367b.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/printed/parts/30367b.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/printed/parts/30367b.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/printed/parts/30367bps7.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/printed/parts/30367bps7.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/printed/parts/30367bps7.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/printed/parts/30367bps7.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/update/version1/parts/3820.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version1/parts/3820.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/update/version1/parts/3820.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version1/parts/3820.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/update/version1/parts/500.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version1/parts/500.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/update/version1/parts/500.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version1/parts/500.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/update/version1/parts/983.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version1/parts/983.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/update/version1/parts/983.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version1/parts/983.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/update/version2/parts/3820.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version2/parts/3820.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/update/version2/parts/3820.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version2/parts/3820.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/update/version2/parts/3821.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version2/parts/3821.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/update/version2/parts/3821.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version2/parts/3821.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/update/version2/parts/500.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version2/parts/500.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/update/version2/parts/500.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version2/parts/500.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/update/version2/parts/983.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version2/parts/983.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/update/version2/parts/983.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/update/version2/parts/983.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/update2/version1/parts/3820.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/update2/version1/parts/3820.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/update2/version1/parts/3820.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/update2/version1/parts/3820.dat diff --git a/tests/Service/Loader/ModelLoader/fixtures/update2/version2/parts/3820.dat b/tests/AppBundle/Service/Loader/ModelLoader/fixtures/update2/version2/parts/3820.dat similarity index 100% rename from tests/Service/Loader/ModelLoader/fixtures/update2/version2/parts/3820.dat rename to tests/AppBundle/Service/Loader/ModelLoader/fixtures/update2/version2/parts/3820.dat diff --git a/tests/Service/Stl/StlConverter/StlConverterTest.php b/tests/AppBundle/Service/Stl/StlConverter/StlConverterTest.php similarity index 83% rename from tests/Service/Stl/StlConverter/StlConverterTest.php rename to tests/AppBundle/Service/Stl/StlConverter/StlConverterTest.php index de17d0b..60935e7 100644 --- a/tests/Service/Stl/StlConverter/StlConverterTest.php +++ b/tests/AppBundle/Service/Stl/StlConverter/StlConverterTest.php @@ -16,6 +16,8 @@ class StlConverterTest extends BaseTest public function setUp() { + parent::setUp(); + $ldview = $this->getParameter('ldview_bin'); $stlFixer = $this->createMock(StlFixerService::class); @@ -26,11 +28,11 @@ class StlConverterTest extends BaseTest public function testConvertToStl() { - $adapter = new Local(__DIR__.'/fixtures/ldraw'); + $adapter = new Local(__DIR__ . '/fixtures/ldraw'); $ldrawLibraryContext = new Filesystem($adapter); $this->stlConverter->setLDrawLibraryContext($ldrawLibraryContext); - $this->assertNotNull($this->stlConverter->datToStl(__DIR__.'/fixtures/ldraw/parts/983.dat')); + $this->assertNotNull($this->stlConverter->datToStl(__DIR__ . '/fixtures/ldraw/parts/983.dat')); $this->assertTrue($this->filesystem->has('models/983.stl')); @@ -42,16 +44,16 @@ class StlConverterTest extends BaseTest */ public function testLDContextMissing() { - $this->stlConverter->datToStl(__DIR__.'/fixtures/ldraw/parts/983.dat'); + $this->stlConverter->datToStl(__DIR__ . '/fixtures/ldraw/parts/983.dat'); } public function testConvertToPng() { - $adapter = new Local(__DIR__.'/fixtures/ldraw'); + $adapter = new Local(__DIR__ . '/fixtures/ldraw'); $ldrawLibraryContext = new Filesystem($adapter); $this->stlConverter->setLDrawLibraryContext($ldrawLibraryContext); - $this->assertNotNull($this->stlConverter->datToPng(__DIR__.'/fixtures/ldraw/parts/983.dat')); + $this->assertNotNull($this->stlConverter->datToPng(__DIR__ . '/fixtures/ldraw/parts/983.dat')); $this->assertTrue($this->filesystem->has('images/983.png')); diff --git a/tests/Service/Stl/StlConverter/fixtures/ldraw/p/2-4edge.dat b/tests/AppBundle/Service/Stl/StlConverter/fixtures/ldraw/p/2-4edge.dat similarity index 100% rename from tests/Service/Stl/StlConverter/fixtures/ldraw/p/2-4edge.dat rename to tests/AppBundle/Service/Stl/StlConverter/fixtures/ldraw/p/2-4edge.dat diff --git a/tests/Service/Stl/StlConverter/fixtures/ldraw/p/3-4edge.dat b/tests/AppBundle/Service/Stl/StlConverter/fixtures/ldraw/p/3-4edge.dat similarity index 100% rename from tests/Service/Stl/StlConverter/fixtures/ldraw/p/3-4edge.dat rename to tests/AppBundle/Service/Stl/StlConverter/fixtures/ldraw/p/3-4edge.dat diff --git a/tests/Service/Stl/StlConverter/fixtures/ldraw/p/4-4edge.dat b/tests/AppBundle/Service/Stl/StlConverter/fixtures/ldraw/p/4-4edge.dat similarity index 100% rename from tests/Service/Stl/StlConverter/fixtures/ldraw/p/4-4edge.dat rename to tests/AppBundle/Service/Stl/StlConverter/fixtures/ldraw/p/4-4edge.dat diff --git a/tests/Service/Stl/StlConverter/fixtures/ldraw/parts/3820.dat b/tests/AppBundle/Service/Stl/StlConverter/fixtures/ldraw/parts/3820.dat similarity index 100% rename from tests/Service/Stl/StlConverter/fixtures/ldraw/parts/3820.dat rename to tests/AppBundle/Service/Stl/StlConverter/fixtures/ldraw/parts/3820.dat diff --git a/tests/Service/Stl/StlConverter/fixtures/ldraw/parts/983.dat b/tests/AppBundle/Service/Stl/StlConverter/fixtures/ldraw/parts/983.dat similarity index 100% rename from tests/Service/Stl/StlConverter/fixtures/ldraw/parts/983.dat rename to tests/AppBundle/Service/Stl/StlConverter/fixtures/ldraw/parts/983.dat diff --git a/tests/Service/Stl/StlFixer/StlFixerTest.php b/tests/AppBundle/Service/Stl/StlFixer/StlFixerTest.php similarity index 91% rename from tests/Service/Stl/StlFixer/StlFixerTest.php rename to tests/AppBundle/Service/Stl/StlFixer/StlFixerTest.php index 80b2982..c29b6f1 100644 --- a/tests/Service/Stl/StlFixer/StlFixerTest.php +++ b/tests/AppBundle/Service/Stl/StlFixer/StlFixerTest.php @@ -21,8 +21,10 @@ class StlFixer extends BaseTest public function setUp() { + parent::setUp(); + $this->stlFixer = new StlFixerService($this->getParameter('admesh_bin')); - $this->input = __DIR__.'/fixtures/ascii.stl'; + $this->input = __DIR__ . '/fixtures/ascii.stl'; } public function tearDown() diff --git a/tests/Service/Stl/StlFixer/fixtures/ascii.stl b/tests/AppBundle/Service/Stl/StlFixer/fixtures/ascii.stl similarity index 100% rename from tests/Service/Stl/StlFixer/fixtures/ascii.stl rename to tests/AppBundle/Service/Stl/StlFixer/fixtures/ascii.stl diff --git a/tests/Service/Stl/StlFixer/fixtures/binary.stl b/tests/AppBundle/Service/Stl/StlFixer/fixtures/binary.stl similarity index 100% rename from tests/Service/Stl/StlFixer/fixtures/binary.stl rename to tests/AppBundle/Service/Stl/StlFixer/fixtures/binary.stl diff --git a/tests/Service/Stl/StlRenderer/StlRendererTest.php b/tests/AppBundle/Service/Stl/StlRenderer/StlRendererTest.php similarity index 82% rename from tests/Service/Stl/StlRenderer/StlRendererTest.php rename to tests/AppBundle/Service/Stl/StlRenderer/StlRendererTest.php index d02a05e..cc8717b 100644 --- a/tests/Service/Stl/StlRenderer/StlRendererTest.php +++ b/tests/AppBundle/Service/Stl/StlRenderer/StlRendererTest.php @@ -20,7 +20,9 @@ class StlRendererTest extends BaseTest public function setUp() { - $layout = $this->get('kernel')->getRootDir().'/Resources/povray_layout/layout.tmpl'; + parent::setUp(); + + $layout = __DIR__ . '/fixtures/layout.tmpl'; $povray = $this->getParameter('povray_bin'); $stl2pov = $this->getParameter('stl2pov_bin'); @@ -34,7 +36,7 @@ class StlRendererTest extends BaseTest public function testRendering() { - $this->stlRenderer->render(__DIR__.'/fixtures/973c00.stl',$this->filesystem->getAdapter()->getPathPrefix()); + $this->stlRenderer->render(__DIR__ . '/fixtures/973c00.stl',$this->filesystem->getAdapter()->getPathPrefix()); $this->assertTrue($this->filesystem->has('973c00.png')); } } \ No newline at end of file diff --git a/tests/Service/Stl/StlRenderer/fixtures/973c00.png b/tests/AppBundle/Service/Stl/StlRenderer/fixtures/973c00.png similarity index 100% rename from tests/Service/Stl/StlRenderer/fixtures/973c00.png rename to tests/AppBundle/Service/Stl/StlRenderer/fixtures/973c00.png diff --git a/tests/Service/Stl/StlRenderer/fixtures/973c00.stl b/tests/AppBundle/Service/Stl/StlRenderer/fixtures/973c00.stl similarity index 100% rename from tests/Service/Stl/StlRenderer/fixtures/973c00.stl rename to tests/AppBundle/Service/Stl/StlRenderer/fixtures/973c00.stl diff --git a/tests/AppBundle/Service/Stl/StlRenderer/fixtures/layout.tmpl b/tests/AppBundle/Service/Stl/StlRenderer/fixtures/layout.tmpl new file mode 100644 index 0000000..fa28b6c --- /dev/null +++ b/tests/AppBundle/Service/Stl/StlRenderer/fixtures/layout.tmpl @@ -0,0 +1,52 @@ +#declare main_mesh = m_MYSOLID; +#include "math.inc" +#include "finish.inc" +#include "transforms.inc" +#include "colors.inc" + +background {color rgb 1} + +light_source { <-10,-15,15> color White } +light_source { <-11,-4,10> color White } +light_source { <-10,14,20> color White } + + +global_settings { + assumed_gamma 2.1 +} + +#declare Min = min_extent( main_mesh ); +#declare Max = max_extent( main_mesh ); + +#declare MaxLength = max( + Max.x-Min.x, + Max.y-Min.y, + Max.z-Min.z +); + +// Calculate camera distace factor - if object is large on Y axis and Z axis move the camera further +#declare cameraDistance = (((Max.y-Min.y)*(1/MaxLength) > 0.3) & ((Max.z-Min.z)*(1/MaxLength) > 0.95) ? 1: 0.9); + +camera +{ + location <-1.5*cameraDistance, -1*cameraDistance, 1.1*cameraDistance> + angle 45 + sky z + look_at 0 + translate <0,0.05,-0.15> + right -1*x +} + +object +{ + main_mesh + Center_Trans(main_mesh, x+y+z) + + texture + { + pigment{ color rgb<0, 0.34, 0.6> } + finish { phong .51} + } + scale (1/MaxLength) +} + diff --git a/tests/AppBundle/Service/ZipServiceTest.php b/tests/AppBundle/Service/ZipServiceTest.php new file mode 100644 index 0000000..e4d670c --- /dev/null +++ b/tests/AppBundle/Service/ZipServiceTest.php @@ -0,0 +1,60 @@ +loadFixtures([ + LoadBaseData::class + ]); + + $this->modelService = $this->get(ModelService::class); + $this->setService = $this->get(SetService::class); + + $this->filesystem->write('models/1.stl',file_get_contents(__DIR__.'/../Fixtures/models/1.stl')); + + $this->zipService = new ZipService($this->filesystem,$this->modelService,$this->setService); + } + + public function tearDown() + { + $this->filesystem->delete('models/1.stl'); + } + + public function testModelZip() + { + $model = $this->modelService->findModel(1); + + $path = $this->zipService->createFromModel($model, 'modelzip'); + + $this->assertFileExists($path); + } + + public function testSetZip() + { + $set = $this->setService->findSet('8049-1'); + + $path = $this->zipService->createFromSet($set, 'setzip'); + + $this->assertFileExists($path); + } +} \ No newline at end of file diff --git a/tests/Transformer/FormatTransformerTest.php b/tests/AppBundle/Transformer/FormatTransformerTest.php similarity index 100% rename from tests/Transformer/FormatTransformerTest.php rename to tests/AppBundle/Transformer/FormatTransformerTest.php diff --git a/tests/Util/LDModelParser/LDModelParserTest.php b/tests/AppBundle/Util/LDModelParser/LDModelParserTest.php similarity index 86% rename from tests/Util/LDModelParser/LDModelParserTest.php rename to tests/AppBundle/Util/LDModelParser/LDModelParserTest.php index e7d4f63..2af970a 100644 --- a/tests/Util/LDModelParser/LDModelParserTest.php +++ b/tests/AppBundle/Util/LDModelParser/LDModelParserTest.php @@ -22,7 +22,7 @@ class LDModelParserTest extends TestCase public function testValid() { - $resource = file_get_contents(__DIR__.'/fixtures/valid.dat'); + $resource = file_get_contents(__DIR__ . '/fixtures/valid.dat'); $array = [ "id" => "1234", @@ -53,13 +53,13 @@ class LDModelParserTest extends TestCase */ public function testInvalid() { - $resource = file_get_contents(__DIR__.'/fixtures/invalid.dat'); + $resource = file_get_contents(__DIR__ . '/fixtures/invalid.dat'); $this->parser->parse($resource); } public function testStickers() { - $resource = file_get_contents(__DIR__.'/fixtures/stickers.txt'); + $resource = file_get_contents(__DIR__ . '/fixtures/stickers.txt'); foreach (preg_split('/^---DAT/m', $resource) as $dat) { $this->assertEquals('Sticker', $this->parser->parse($dat)['type']); @@ -68,7 +68,7 @@ class LDModelParserTest extends TestCase public function testAlias() { - $resource = file_get_contents(__DIR__.'/fixtures/alias.txt'); + $resource = file_get_contents(__DIR__ . '/fixtures/alias.txt'); foreach (preg_split('/^---DAT/m', $resource) as $dat) { $this->assertEquals('parent', $this->parser->parse($dat)['parent']); diff --git a/tests/Util/LDModelParser/fixtures/alias.txt b/tests/AppBundle/Util/LDModelParser/fixtures/alias.txt similarity index 100% rename from tests/Util/LDModelParser/fixtures/alias.txt rename to tests/AppBundle/Util/LDModelParser/fixtures/alias.txt diff --git a/tests/Util/LDModelParser/fixtures/invalid.dat b/tests/AppBundle/Util/LDModelParser/fixtures/invalid.dat similarity index 100% rename from tests/Util/LDModelParser/fixtures/invalid.dat rename to tests/AppBundle/Util/LDModelParser/fixtures/invalid.dat diff --git a/tests/Util/LDModelParser/fixtures/stickers.txt b/tests/AppBundle/Util/LDModelParser/fixtures/stickers.txt similarity index 100% rename from tests/Util/LDModelParser/fixtures/stickers.txt rename to tests/AppBundle/Util/LDModelParser/fixtures/stickers.txt diff --git a/tests/Util/LDModelParser/fixtures/valid.dat b/tests/AppBundle/Util/LDModelParser/fixtures/valid.dat similarity index 100% rename from tests/Util/LDModelParser/fixtures/valid.dat rename to tests/AppBundle/Util/LDModelParser/fixtures/valid.dat diff --git a/tests/Util/RelationMapper/RelationMapperTest.php b/tests/AppBundle/Util/RelationMapper/RelationMapperTest.php similarity index 89% rename from tests/Util/RelationMapper/RelationMapperTest.php rename to tests/AppBundle/Util/RelationMapper/RelationMapperTest.php index 289d0c8..2146aea 100644 --- a/tests/Util/RelationMapper/RelationMapperTest.php +++ b/tests/AppBundle/Util/RelationMapper/RelationMapperTest.php @@ -13,7 +13,7 @@ class RelationMapperTest extends TestCase public function testLoad() { $mapper = new RelationMapper(new ArrayCache()); - $mapper->loadResource(__DIR__.'/fixtures/resources.yml', 'resources'); + $mapper->loadResource(__DIR__ . '/fixtures/resources.yml', 'resources'); $this->assertEquals('bar', $mapper->find('foo','resources')); $this->assertEquals('bar', $mapper->find('bar','resources')); @@ -35,7 +35,7 @@ class RelationMapperTest extends TestCase public function testLoadInvalidResource() { $mapper = new RelationMapper(new ArrayCache()); - $resource = __DIR__.'/fixtures/invalid.yml'; + $resource = __DIR__ . '/fixtures/invalid.yml'; $mapper->loadResource($resource, 'resources'); } } \ No newline at end of file diff --git a/tests/Util/RelationMapper/fixtures/empty.yml b/tests/AppBundle/Util/RelationMapper/fixtures/empty.yml similarity index 100% rename from tests/Util/RelationMapper/fixtures/empty.yml rename to tests/AppBundle/Util/RelationMapper/fixtures/empty.yml diff --git a/tests/Util/RelationMapper/fixtures/invalid.yml b/tests/AppBundle/Util/RelationMapper/fixtures/invalid.yml similarity index 100% rename from tests/Util/RelationMapper/fixtures/invalid.yml rename to tests/AppBundle/Util/RelationMapper/fixtures/invalid.yml diff --git a/tests/Util/RelationMapper/fixtures/resources.yml b/tests/AppBundle/Util/RelationMapper/fixtures/resources.yml similarity index 100% rename from tests/Util/RelationMapper/fixtures/resources.yml rename to tests/AppBundle/Util/RelationMapper/fixtures/resources.yml diff --git a/tests/Service/ZipServiceTest.php b/tests/Service/ZipServiceTest.php deleted file mode 100644 index 83de053..0000000 --- a/tests/Service/ZipServiceTest.php +++ /dev/null @@ -1,10 +0,0 @@ -