GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( a48bd8...83d092 )
by joseph
16:18 queued 18s
created

Large/D/Entity/Savers/EntitySaverLargeTest.php (2 issues)

Labels
Severity
1
<?php declare(strict_types=1);
2
3
namespace EdmondsCommerce\DoctrineStaticMeta\Tests\Large\D\Entity\Savers;
4
5
use EdmondsCommerce\DoctrineStaticMeta\Entity\Repositories\RepositoryFactory;
6
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractLargeTest;
7
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\AbstractTest;
8
use EdmondsCommerce\DoctrineStaticMeta\Tests\Assets\TestCodeGenerator;
9
10
/**
11
 * @large
12
 * @covers \EdmondsCommerce\DoctrineStaticMeta\Entity\Savers\EntitySaver
13
 */
14
class EntitySaverLargeTest extends AbstractLargeTest
15
{
16
    public const WORK_DIR = AbstractTest::VAR_PATH . '/' . self::TEST_TYPE_LARGE . '/EntitySaverLargeTest';
17
18
    private const TEST_ENTITIES = [
19
        self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_PERSON,
20
        self::TEST_ENTITIES_ROOT_NAMESPACE . TestCodeGenerator::TEST_ENTITY_ALL_ARCHETYPE_FIELDS,
21
    ];
22
23
    protected static $buildOnce = true;
24
25
    public function setup()
26
    {
27
        parent::setUp();
28
        if (false === self::$built) {
29
            $this->getTestCodeGenerator()
30
                 ->copyTo(self::WORK_DIR);
31
            self::$built = true;
32
        }
33
        $this->setupCopiedWorkDirAndCreateDatabase();
34
    }
35
36
    public function testItCanSaveAndRemoveASingleEntity(): void
37
    {
38
        $entityFqn = $this->getCopiedFqn(self::TEST_ENTITIES[0]);
39
        $entity    = $this->createEntity($entityFqn);
40
        $entity->update(
41
            $this->getEntityDtoFactory()
42
                 ->createDtoFromEntity($entity)
43
                 ->setString('blah')
44
                 ->setFloat(2.2)
45
        );
46
        $saver = $this->getEntitySaver();
47
        $saver->save($entity);
48
        $loaded = $this->findAllEntity($entityFqn)[0];
49
        self::assertSame($entity->getString(), $loaded->getString());
0 ignored issues
show
The method getString() does not exist on EdmondsCommerce\Doctrine...erfaces\EntityInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
        self::assertSame($entity->/** @scrutinizer ignore-call */ getString(), $loaded->getString());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
50
        self::assertSame($entity->getFloat(), $loaded->getFloat());
0 ignored issues
show
The method getFloat() does not exist on EdmondsCommerce\Doctrine...erfaces\EntityInterface. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

50
        self::assertSame($entity->/** @scrutinizer ignore-call */ getFloat(), $loaded->getFloat());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
51
        $saver->remove($loaded);
52
        self::assertSame([], $this->findAllEntity($entityFqn));
53
    }
54
55
    protected function findAllEntity(string $entityFqn): array
56
    {
57
        return $this->container->get(RepositoryFactory::class)->getRepository($entityFqn)->findAll();
58
    }
59
60
    public function testItCanSaveAndRemoveMultipleEntities(): void
61
    {
62
        $entities = [];
63
        foreach (self::TEST_ENTITIES as $entityFqn) {
64
            $entityFqn = $this->getCopiedFqn($entityFqn);
65
            $generator = $this->getTestEntityGeneratorFactory()->createForEntityFqn($entityFqn)->getGenerator();
66
            foreach ($generator as $key => $entity) {
67
                $entity->update(
68
                    $this->getEntityDtoFactory()
69
                         ->createDtoFromEntity($entity)
70
                         ->setString('blah')
71
                         ->setFloat(2.2)
72
                );
73
                $entities[$entityFqn . $key] = $entity;
74
                if ($key === 9) {
75
                    break;
76
                }
77
            }
78
        }
79
        $saver = $this->getEntitySaver();
80
        $saver->saveAll($entities);
81
        foreach (self::TEST_ENTITIES as $entityFqn) {
82
            $entityFqn = $this->getCopiedFqn($entityFqn);
83
            $loaded    = $this->findAllEntity($entityFqn);
84
            self::assertCount(10, $loaded);
85
            foreach (range(0, 9) as $num) {
86
                self::assertSame($entities[$entityFqn . $num]->getString(), $loaded[$num]->getString());
87
                self::assertSame($entities[$entityFqn . $num]->getFloat(), $loaded[$num]->getFloat());
88
            }
89
        }
90
91
        $saver->removeAll($entities);
92
        foreach (self::TEST_ENTITIES as $entityFqn) {
93
            $entityFqn = $this->getCopiedFqn($entityFqn);
94
            self::assertSame([], $this->findAllEntity($entityFqn));
95
        }
96
    }
97
}
98