Code Duplication    Length = 11-14 lines in 5 locations

tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php 5 locations

@@ 105-115 (lines=11) @@
102
    /**
103
     * @group DDC-1649
104
     */
105
    public function testInvalidTripleAssociationAsKeyMapping()
106
    {
107
        $classThree = $this->em->getClassMetadata(DDC1649Three::class);
108
        $ce = $this->validator->validateClass($classThree);
109
110
        $this->assertEquals(
111
            [
112
            "Cannot map association 'Doctrine\Tests\ORM\Tools\DDC1649Three#two as identifier, because the target entity 'Doctrine\Tests\ORM\Tools\DDC1649Two' also maps an association as identifier.",
113
            "The referenced column name 'id' has to be a primary key column on the target entity class 'Doctrine\Tests\ORM\Tools\DDC1649Two'."
114
            ], $ce);
115
    }
116
117
    /**
118
     * @group DDC-3274
@@ 120-133 (lines=14) @@
117
    /**
118
     * @group DDC-3274
119
     */
120
    public function testInvalidBiDirectionalRelationMappingMissingInversedByAttribute()
121
    {
122
        $class = $this->em->getClassMetadata(DDC3274One::class);
123
        $ce = $this->validator->validateClass($class);
124
125
        $this->assertEquals(
126
            [
127
                "The field Doctrine\Tests\ORM\Tools\DDC3274One#two is on the inverse side of a bi-directional " .
128
                "relationship, but the specified mappedBy association on the target-entity " .
129
                "Doctrine\Tests\ORM\Tools\DDC3274Two#one does not contain the required 'inversedBy=\"two\"' attribute."
130
            ],
131
            $ce
132
        );
133
    }
134
135
    /**
136
     * @group DDC-3322
@@ 138-150 (lines=13) @@
135
    /**
136
     * @group DDC-3322
137
     */
138
    public function testInvalidOrderByInvalidField()
139
    {
140
        $class = $this->em->getClassMetadata(DDC3322One::class);
141
        $ce = $this->validator->validateClass($class);
142
143
        $this->assertEquals(
144
            [
145
                "The association Doctrine\Tests\ORM\Tools\DDC3322One#invalidAssoc is ordered by a foreign field " .
146
                "invalidField that is not a field on the target entity Doctrine\Tests\ORM\Tools\DDC3322ValidEntity1."
147
            ],
148
            $ce
149
        );
150
    }
151
152
    /**
153
     * @group DDC-3322
@@ 155-167 (lines=13) @@
152
    /**
153
     * @group DDC-3322
154
     */
155
    public function testInvalidOrderByCollectionValuedAssociation()
156
    {
157
        $class = $this->em->getClassMetadata(DDC3322Two::class);
158
        $ce = $this->validator->validateClass($class);
159
160
        $this->assertEquals(
161
            [
162
                "The association Doctrine\Tests\ORM\Tools\DDC3322Two#invalidAssoc is ordered by a field oneToMany " .
163
                "on Doctrine\Tests\ORM\Tools\DDC3322ValidEntity1 that is a collection-valued association."
164
            ],
165
            $ce
166
        );
167
    }
168
169
    /**
170
     * @group DDC-3322
@@ 172-184 (lines=13) @@
169
    /**
170
     * @group DDC-3322
171
     */
172
    public function testInvalidOrderByAssociationInverseSide()
173
    {
174
        $class = $this->em->getClassMetadata(DDC3322Three::class);
175
        $ce = $this->validator->validateClass($class);
176
177
        $this->assertEquals(
178
            [
179
                "The association Doctrine\Tests\ORM\Tools\DDC3322Three#invalidAssoc is ordered by a field oneToOneInverse " .
180
                "on Doctrine\Tests\ORM\Tools\DDC3322ValidEntity1 that is the inverse side of an association."
181
            ],
182
            $ce
183
        );
184
    }
185
}
186
187
/**