mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-03-12 07:46:06 +03:00
Additional printer test
This commit is contained in:
parent
6e7cf27579
commit
d87c1aba5c
@ -488,6 +488,6 @@ class Printer
|
|||||||
|
|
||||||
return (($value[0] === ' ' || $value[0] === "\t") && strpos($value, "\n") === false)
|
return (($value[0] === ' ' || $value[0] === "\t") && strpos($value, "\n") === false)
|
||||||
? ('"""' . preg_replace('/"$/', "\"\n", $escaped) . '"""')
|
? ('"""' . preg_replace('/"$/', "\"\n", $escaped) . '"""')
|
||||||
: ("\"\"\"\n" . ($isDescription ? $escaped : $this->indent($escaped)) . "\n\"\"\"");
|
: ('"""' . "\n" . ($isDescription ? $escaped : $this->indent($escaped)) . "\n" . '"""');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ class PrinterTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @it correctly prints single-line block strings with leading space
|
* @it correctly prints single-line with leading space
|
||||||
*/
|
*/
|
||||||
public function testCorrectlyPrintsSingleLineBlockStringsWithLeadingSpace()
|
public function testCorrectlyPrintsSingleLineBlockStringsWithLeadingSpace()
|
||||||
{
|
{
|
||||||
@ -110,7 +110,7 @@ class PrinterTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @it correctly prints block strings with a first line indentation
|
* @it correctly prints string with a first line indentation
|
||||||
*/
|
*/
|
||||||
public function testCorrectlyPrintsBlockStringsWithAFirstLineIndentation()
|
public function testCorrectlyPrintsBlockStringsWithAFirstLineIndentation()
|
||||||
{
|
{
|
||||||
@ -134,6 +134,27 @@ class PrinterTest extends TestCase
|
|||||||
$this->assertEquals($expected, Printer::doPrint($mutationAstWithArtifacts));
|
$this->assertEquals($expected, Printer::doPrint($mutationAstWithArtifacts));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @it correctly prints single-line with leading space and quotation
|
||||||
|
*/
|
||||||
|
public function testCorrectlyPrintsSingleLineWithLeadingSpaceAndQuotation()
|
||||||
|
{
|
||||||
|
$mutationAstWithArtifacts = Parser::parse('
|
||||||
|
{
|
||||||
|
field(arg: """ space-led value "quoted string"
|
||||||
|
""")
|
||||||
|
}
|
||||||
|
');
|
||||||
|
$expected = <<<END
|
||||||
|
{
|
||||||
|
field(arg: """ space-led value "quoted string"
|
||||||
|
""")
|
||||||
|
}
|
||||||
|
|
||||||
|
END;
|
||||||
|
$this->assertEquals($expected, Printer::doPrint($mutationAstWithArtifacts));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @it Experimental: correctly prints fragment defined variables
|
* @it Experimental: correctly prints fragment defined variables
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user