Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 54ad150

Browse files
committedSep 5, 2019
Backporting unit test fix
1 parent b5d7e9f commit 54ad150

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed
 

‎tests/Mappers/GlobTypeMapperTest.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,19 @@ public function testGlobTypeMapperDuplicateInputTypesException()
7979

8080
$mapper = new GlobTypeMapper('TheCodingMachine\GraphQLite\Fixtures\DuplicateInputTypes', $typeGenerator, $this->getInputTypeGenerator(), $this->getInputTypeUtils(), $container, new \TheCodingMachine\GraphQLite\AnnotationReader(new AnnotationReader()), new NamingStrategy(), $this->getLockFactory(), new NullCache());
8181

82-
$this->expectException(DuplicateMappingException::class);
83-
$this->expectExceptionMessage('The class \'TheCodingMachine\GraphQLite\Fixtures\TestObject\' should be mapped to only one GraphQL Input type. Two methods are pointing via the @Factory annotation to this class: \'TheCodingMachine\GraphQLite\Fixtures\DuplicateInputTypes\TestFactory::myFactory\' and \'TheCodingMachine\GraphQLite\Fixtures\DuplicateInputTypes\TestFactory2::myFactory\'');
84-
$mapper->canMapClassToInputType(TestObject::class);
82+
$caught = false;
83+
try {
84+
$mapper->canMapClassToInputType(TestObject::class);
85+
} catch (DuplicateMappingException $e) {
86+
// Depending on the environment, one of the messages can be returned.
87+
$this->assertContains($e->getMessage(),
88+
[
89+
'The class \'TheCodingMachine\GraphQLite\Fixtures\TestObject\' should be mapped to only one GraphQL Input type. Two methods are pointing via the @Factory annotation to this class: \'TheCodingMachine\GraphQLite\Fixtures\DuplicateInputTypes\TestFactory::myFactory\' and \'TheCodingMachine\GraphQLite\Fixtures\DuplicateInputTypes\TestFactory2::myFactory\'',
90+
'The class \'TheCodingMachine\GraphQLite\Fixtures\TestObject\' should be mapped to only one GraphQL Input type. Two methods are pointing via the @Factory annotation to this class: \'TheCodingMachine\GraphQLite\Fixtures\DuplicateInputTypes\TestFactory2::myFactory\' and \'TheCodingMachine\GraphQLite\Fixtures\DuplicateInputTypes\TestFactory::myFactory\''
91+
]);
92+
$caught = true;
93+
}
94+
$this->assertTrue($caught, 'DuplicateMappingException is thrown');
8595
}
8696

8797
public function testGlobTypeMapperClassNotFoundException()

0 commit comments

Comments
 (0)
Please sign in to comment.