Code Duplication    Length = 33-38 lines in 2 locations

Tests/Units/ClassMetadataFactoryTests.php 1 location

@@ 170-202 (lines=33) @@
167
    /**
168
     * Test GetMetadataFor method.
169
     */
170
    public function testGetMetadataFor()
171
    {
172
        $this
173
            ->given($factory = $this->createFactory())
174
            ->when($metadatas = $factory->getAllMetadata())
175
            ->then()
176
                ->array($metadatas)
177
                    ->hasSize(2)
178
                ->object($classMetadata = $factory->getMetadataFor(User::class))
179
                    ->isInstanceOf(ClassMetadata::class)
180
                ->array($classMetadata->propertiesMetadata())
181
                    ->hasSize(7)
182
                    ->hasKey('id')
183
                    ->hasKey('name')
184
                    ->hasKey('username')
185
                    ->hasKey('age')
186
                    ->hasKey('email')
187
                    ->hasKey('addresses')
188
                    ->hasKey('friends')
189
                ->object($propertyMetadata = $classMetadata->propertyMetadata('id'))
190
                    ->isNotNull()
191
                ->boolean($propertyMetadata->getMetadata('identifier'))
192
                    ->isTrue()
193
                ->string($propertyMetadata->getMetadata('name'))
194
                    ->isEqualTo('_id')
195
                ->string($classMetadata->propertyMetadata('name')->getMetadata('name'))
196
                    ->isEqualTo('fullName')
197
                ->string($classMetadata->propertyMetadata('addresses')->getMetadata('type'))
198
                    ->isEqualTo('ArraySet')
199
                ->string($classMetadata->propertyMetadata('addresses')->getMetadata('of'))
200
                    ->isEqualTo('Cubiche\Core\Metadata\Tests\Fixtures\Address')
201
        ;
202
    }
203
204
    /**
205
     * Test HasMetadataFor method.

Tests/Units/Driver/ChainDriverTests.php 1 location

@@ 71-108 (lines=38) @@
68
    /**
69
     * Test LoadMetadataForClass method.
70
     */
71
    public function testLoadMetadataForClass()
72
    {
73
        parent::testLoadMetadataForClass();
74
75
        $this
76
            ->given($driver = $this->createDriverWithDefaultDriver())
77
            ->when($classMetadata = $driver->loadMetadataForClass(User::class))
78
            ->then()
79
                ->array($classMetadata->propertiesMetadata())
80
                    ->hasSize(7)
81
                    ->hasKey('id')
82
                    ->hasKey('name')
83
                    ->hasKey('username')
84
                    ->hasKey('age')
85
                    ->hasKey('email')
86
                    ->hasKey('addresses')
87
                    ->hasKey('friends')
88
                ->object($propertyMetadata = $classMetadata->propertyMetadata('id'))
89
                    ->isNotNull()
90
                ->boolean($propertyMetadata->getMetadata('identifier'))
91
                    ->isTrue()
92
                ->string($propertyMetadata->getMetadata('name'))
93
                    ->isEqualTo('_id')
94
                ->string($classMetadata->propertyMetadata('name')->getMetadata('name'))
95
                    ->isEqualTo('fullName')
96
                ->string($classMetadata->propertyMetadata('addresses')->getMetadata('type'))
97
                    ->isEqualTo('ArraySet')
98
                ->string($classMetadata->propertyMetadata('addresses')->getMetadata('of'))
99
                    ->isEqualTo('Cubiche\Core\Metadata\Tests\Fixtures\Address')
100
        ;
101
102
        $this
103
            ->given($driver = $this->createEmptyDriver())
104
            ->then()
105
                ->variable($driver->loadMetadataForClass(User::class))
106
                    ->isNull()
107
        ;
108
    }
109
110
    /**
111
     * Test GetAllClassNames method.