public function testRejectsWhenAPossibleTypeDoesNotImplementTheInterface()
{
// rejects when a possible type does not implement the interface
$InterfaceType = new InterfaceType(['name' => 'InterfaceType', 'fields' => []]);
$SubType = new ObjectType(['name' => 'SubType', 'fields' => [], 'interfaces' => []]);
InterfaceType::addImplementationToInterfaces($SubType, [$InterfaceType]);
// Sanity check.
$this->assertEquals(1, count($InterfaceType->getPossibleTypes()));
$this->assertEquals($SubType, $InterfaceType->getPossibleTypes()[0]);
$schema = new Schema($InterfaceType);
$validationResult = SchemaValidator::validate($schema, [SchemaValidator::interfacePossibleTypesMustImplementTheInterfaceRule()]);
$this->assertSame(false, $validationResult->isValid);
$this->assertSame(1, count($validationResult->errors));
$this->assertSame('SubType is a possible type of interface InterfaceType but does not ' . 'implement it!', $validationResult->errors[0]->message);
}