edmondscommerce /
doctrine-static-meta
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Medium\Entity\Testing; |
||
| 6 | |||
| 7 | use EdmondsCommerce\DoctrineStaticMeta\AbstractIntegrationTest; |
||
|
0 ignored issues
–
show
|
|||
| 8 | use EdmondsCommerce\DoctrineStaticMeta\Entity\Interfaces\EntityInterface; |
||
| 9 | use EdmondsCommerce\DoctrineStaticMeta\Entity\Testing\EntityDebugDumper; |
||
| 10 | use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractTest; |
||
| 11 | use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\TestCodeGenerator; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Class EntityDebugDumperTest |
||
| 15 | * |
||
| 16 | * @package EdmondsCommerce\DoctrineStaticMeta\Entity\Testing |
||
| 17 | * @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\Testing\EntityDebugDumper |
||
| 18 | * @medium |
||
| 19 | */ |
||
| 20 | class EntityDebugDumperTest extends AbstractTest |
||
| 21 | { |
||
| 22 | public const WORK_DIR = AbstractTest::VAR_PATH . '/' . self::TEST_TYPE_MEDIUM . '/EntityDebugDumperTest'; |
||
| 23 | |||
| 24 | private const TEST_ENTITY_FQN = self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_PERSON; |
||
| 25 | |||
| 26 | private const VALUE_DECIMAL = '20.10000000000000'; |
||
| 27 | protected static $buildOnce = true; |
||
| 28 | /** |
||
| 29 | * @var EntityDebugDumper |
||
| 30 | */ |
||
| 31 | private static $dumper; |
||
| 32 | |||
| 33 | public function setup() |
||
| 34 | { |
||
| 35 | parent::setUp(); |
||
| 36 | if (false === self::$built) { |
||
| 37 | $this->getTestCodeGenerator() |
||
| 38 | ->copyTo(self::WORK_DIR); |
||
| 39 | self::$built = true; |
||
| 40 | } |
||
| 41 | $this->setupCopiedWorkDir(); |
||
| 42 | } |
||
| 43 | |||
| 44 | public static function setUpBeforeClass() |
||
| 45 | { |
||
| 46 | parent::setUpBeforeClass(); |
||
| 47 | self::$dumper = new EntityDebugDumper(); |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @test |
||
| 52 | */ |
||
| 53 | public function itRemovesTrailingZerosOnDecimals(): string |
||
| 54 | { |
||
| 55 | $dump = self::$dumper->dump($this->getEntity()); |
||
| 56 | self::assertNotContains(self::VALUE_DECIMAL, $dump); |
||
| 57 | |||
| 58 | return $dump; |
||
| 59 | } |
||
| 60 | |||
| 61 | private function getEntity(): EntityInterface |
||
| 62 | { |
||
| 63 | $emailAddressDto = $this->getEntityDtoFactory() |
||
| 64 | ->createEmptyDtoFromEntityFqn( |
||
| 65 | $this->getCopiedFqn( |
||
| 66 | self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_EMAIL |
||
| 67 | ) |
||
| 68 | )->setEmailAddress('[email protected]'); |
||
| 69 | |||
| 70 | $personDto = $this->getEntityDtoFactory() |
||
| 71 | ->createEmptyDtoFromEntityFqn($this->getCopiedFqn(self::TEST_ENTITY_FQN)) |
||
| 72 | ->setDecimal(self::VALUE_DECIMAL); |
||
| 73 | $personDto->getAttributesEmails()->add($emailAddressDto); |
||
| 74 | $this->getDataFillerFactory() |
||
| 75 | ->getInstanceFromEntityFqn($this->getCopiedFqn(self::TEST_ENTITY_FQN)) |
||
| 76 | ->updateDtoWithFakeData($personDto); |
||
| 77 | |||
| 78 | $entity = $this->createEntity( |
||
| 79 | $this->getCopiedFqn(self::TEST_ENTITY_FQN), |
||
| 80 | $personDto |
||
| 81 | ); |
||
| 82 | |||
| 83 | return $entity; |
||
| 84 | } |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @test |
||
| 88 | * @depends itRemovesTrailingZerosOnDecimals |
||
| 89 | * |
||
| 90 | * @param string $dump |
||
| 91 | */ |
||
| 92 | public function itConvertsCollectionsToAListOfIDs(string $dump): void |
||
| 93 | { |
||
| 94 | self::assertStringContainsString( |
||
| 95 | '[getAttributesEmails] => Array |
||
| 96 | ( |
||
| 97 | [0] => EntityDebugDumperTest_ItRemovesTrailingZerosOnDecimals_\Entities\Attributes\Email:', |
||
| 98 | $dump |
||
| 99 | ); |
||
| 100 | } |
||
| 101 | } |
||
| 102 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths