assertEquals($expected, $actual); $doubleDigit = new Error( 'Left padded first line number', null, new Source("*\n", 'Test', new SourceLocation(9, 1)), [0] ); $actual = FormattedError::printError($doubleDigit); $expected = 'Left padded first line number Test (9:1) 9: * ^ 10: '; $this->assertEquals($expected, $actual); } /** * @it prints an error with nodes from different sources */ public function testPrintsAnErrorWithNodesFromDifferentSources() { $sourceA = Parser::parse(new Source('type Foo { field: String }', 'SourceA' )); $fieldTypeA = $sourceA->definitions[0]->fields[0]->type; $sourceB = Parser::parse(new Source('type Foo { field: Int }', 'SourceB' )); $fieldTypeB = $sourceB->definitions[0]->fields[0]->type; $error = new Error( 'Example error with two nodes', [ $fieldTypeA, $fieldTypeB, ] ); $this->assertEquals( 'Example error with two nodes SourceA (2:10) 1: type Foo { 2: field: String ^ 3: } SourceB (2:10) 1: type Foo { 2: field: Int ^ 3: } ', FormattedError::printError($error) ); } }