Skip to content

Commit

Permalink
SchemaValidator: Use more meaningful variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
Majkl578 committed Jan 30, 2018
1 parent da7288e commit 93558d4
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function testInvalidManyToManyJoinColumnSchema()
$class1 = $this->em->getClassMetadata(InvalidEntity1::class);
$class2 = $this->em->getClassMetadata(InvalidEntity2::class);

$ce = $this->validator->validateClass($class1);
$errors = $this->validator->validateClass($class1);

$message1 = "The inverse join columns of the many-to-many table '%s' have to contain to ALL identifier columns of the target entity '%s', however '%s' are missing.";
$message2 = "The join columns of the many-to-many table '%s' have to contain to ALL identifier columns of the source entity '%s', however '%s' are missing.";
Expand All @@ -69,7 +69,7 @@ public function testInvalidManyToManyJoinColumnSchema()
sprintf($message1, 'Entity1Entity2', InvalidEntity2::class, 'key4'),
sprintf($message2, 'Entity1Entity2', InvalidEntity1::class, 'key2'),
],
$ce
$errors
);
}

Expand All @@ -81,7 +81,7 @@ public function testInvalidToOneJoinColumnSchema()
$class1 = $this->em->getClassMetadata(InvalidEntity1::class);
$class2 = $this->em->getClassMetadata(InvalidEntity2::class);

$ce = $this->validator->validateClass($class2);
$errors = $this->validator->validateClass($class2);

$message1 = "The referenced column name '%s' has to be a primary key column on the target entity class '%s'.";
$message2 = "The join columns of the association '%s' have to match to ALL identifier columns of the target entity '%s', however '%s' are missing.";
Expand All @@ -91,7 +91,7 @@ public function testInvalidToOneJoinColumnSchema()
sprintf($message1, 'id', InvalidEntity1::class),
sprintf($message2, 'assoc', InvalidEntity1::class, "key1', 'key2"),
],
$ce
$errors
);
}

Expand All @@ -103,9 +103,9 @@ public function testValidOneToOneAsIdentifierSchema()
$class1 = $this->em->getClassMetadata(DDC1587ValidEntity2::class);
$class2 = $this->em->getClassMetadata(DDC1587ValidEntity1::class);

$ce = $this->validator->validateClass($class1);
$errors = $this->validator->validateClass($class1);

self::assertEquals([], $ce);
self::assertEquals([], $errors);
}

/**
Expand All @@ -114,7 +114,7 @@ public function testValidOneToOneAsIdentifierSchema()
public function testInvalidTripleAssociationAsKeyMapping()
{
$classThree = $this->em->getClassMetadata(DDC1649Three::class);
$ce = $this->validator->validateClass($classThree);
$errors = $this->validator->validateClass($classThree);

$message1 = "Cannot map association %s#%s as identifier, because the target entity '%s' also maps an association as identifier.";
$message2 = "The referenced column name '%s' has to be a primary key column on the target entity class '%s'.";
Expand All @@ -124,7 +124,7 @@ public function testInvalidTripleAssociationAsKeyMapping()
sprintf($message1, DDC1649Three::class, 'two', DDC1649Two::class),
sprintf($message2, 'id', DDC1649Two::class),
],
$ce
$errors
);
}

Expand All @@ -134,7 +134,7 @@ public function testInvalidTripleAssociationAsKeyMapping()
public function testInvalidBiDirectionalRelationMappingMissingInversedByAttribute()
{
$class = $this->em->getClassMetadata(DDC3274One::class);
$ce = $this->validator->validateClass($class);
$errors = $this->validator->validateClass($class);

$message = "The property %s#%s is on the inverse side of a bi-directional relationship, but the "
. "specified mappedBy association on the target-entity %s#%s does not contain the required 'inversedBy=\"%s\"' attribute.";
Expand All @@ -143,7 +143,7 @@ public function testInvalidBiDirectionalRelationMappingMissingInversedByAttribut
[
sprintf($message, DDC3274One::class, 'two', DDC3274Two::class, 'one', 'two')
],
$ce
$errors
);
}

Expand All @@ -153,15 +153,15 @@ public function testInvalidBiDirectionalRelationMappingMissingInversedByAttribut
public function testInvalidOrderByInvalidField()
{
$class = $this->em->getClassMetadata(DDC3322One::class);
$ce = $this->validator->validateClass($class);
$errors = $this->validator->validateClass($class);

$message = "The association %s#%s is ordered by a property '%s' that is non-existing field on the target entity '%s'.";

self::assertEquals(
[
sprintf($message, DDC3322One::class, 'invalidAssoc', 'invalidField', DDC3322ValidEntity1::class)
],
$ce
$errors
);
}

Expand All @@ -171,15 +171,15 @@ public function testInvalidOrderByInvalidField()
public function testInvalidOrderByCollectionValuedAssociation()
{
$class = $this->em->getClassMetadata(DDC3322Two::class);
$ce = $this->validator->validateClass($class);
$errors = $this->validator->validateClass($class);

$message = "The association %s#%s is ordered by a property '%s' on '%s' that is a collection-valued association.";

self::assertEquals(
[
sprintf($message, DDC3322Two::class, 'invalidAssoc', 'oneToMany', DDC3322ValidEntity1::class)
],
$ce
$errors
);
}

Expand All @@ -189,30 +189,30 @@ public function testInvalidOrderByCollectionValuedAssociation()
public function testInvalidOrderByAssociationInverseSide()
{
$class = $this->em->getClassMetadata(DDC3322Three::class);
$ce = $this->validator->validateClass($class);
$errors = $this->validator->validateClass($class);

$message = "The association %s#%s is ordered by a property '%s' on '%s' that is the inverse side of an association.";

self::assertEquals(
[
sprintf($message, DDC3322Three::class, 'invalidAssoc', 'oneToOneInverse', DDC3322ValidEntity1::class)
],
$ce
$errors
);
}

public function testInvalidReferencedJoinTableColumnIsNotPrimary() : void
{
$class = $this->em->getClassMetadata(InvalidEntity3::class);
$ce = $this->validator->validateClass($class);
$errors = $this->validator->validateClass($class);

$message = "The referenced column name '%s' has to be a primary key column on the target entity class '%s'.";

self::assertEquals(
[
sprintf($message, 'nonId4', InvalidEntity4::class)
],
$ce
$errors
);
}
}
Expand Down

0 comments on commit 93558d4

Please sign in to comment.