Code Duplication    Length = 28-30 lines in 2 locations

Tests/EntityFactoryTest.php 1 location

@@ 41-68 (lines=28) @@
38
        self::assertEquals('test-payload', $entity->getPayload());
39
    }
40
41
    public function testInheritanceLoading()
42
    {
43
        $repository = $this->getManager()->getRepository(SubEntity::class);
44
        $this->getClient()->push(
45
            $this->getResponseMock(
46
                true,
47
                (object)[
48
                    'id'          => 2,
49
                    'payload'     => 'test-payload',
50
                    'sub-payload' => 'sub-payload',
51
                ]
52
            ),
53
            function (RpcRequestInterface $request) {
54
                self::assertEquals('test-entity/find', $request->getMethod());
55
                self::assertEquals(['id' => 2], $request->getParameters());
56
57
                return true;
58
            }
59
        );
60
61
        /** @var SubEntity $entity */
62
        $entity = $repository->find(2);
63
64
        self::assertInstanceOf(SubEntity::class, $entity);
65
        self::assertEquals(2, $entity->getId());
66
        self::assertEquals('test-payload', $entity->getPayload());
67
        self::assertEquals('sub-payload', $entity->getSubPayload());
68
    }
69
70
    public function testCompositeKeyLoading()
71
    {

Tests/ProxyTest.php 1 location

@@ 57-86 (lines=30) @@
54
        self::assertCount(0, $this->getClient());
55
    }
56
57
    public function testSimpleProxy()
58
    {
59
        $repository = $this->getManager()->getRepository(SubEntity::class);
60
61
        $this->getClient()->push(
62
            $this->getResponseMock(
63
                true,
64
                (object)[
65
                    'id'          => 2,
66
                    'payload'     => 'test-payload',
67
                    'sub-payload' => 'sub-payload',
68
                ]
69
            ),
70
            function (RpcRequestInterface $request) {
71
                self::assertEquals('test-entity/find', $request->getMethod());
72
                self::assertEquals(['id' => 2], $request->getParameters());
73
74
                return true;
75
            }
76
        );
77
78
        /** @var SubEntity $entity */
79
        $entity = $repository->find(2);
80
81
        //Test that we can obtain data and request was sent
82
        self::assertInstanceOf(SubEntity::class, $entity);
83
        self::assertEquals(2, $entity->getId());
84
        self::assertEquals('test-payload', $entity->getPayload());
85
        self::assertEquals('sub-payload', $entity->getSubPayload());
86
    }
87
88
    protected function getClientNames()
89
    {