mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 07:49:24 +03:00
Fix orList to be the same as in JS and follow the chicago style for commas
This commit is contained in:
parent
d92a2dab21
commit
dc6e814de3
@ -500,7 +500,7 @@ class Utils
|
|||||||
range(1, $selectedLength - 1),
|
range(1, $selectedLength - 1),
|
||||||
function ($list, $index) use ($selected, $selectedLength) {
|
function ($list, $index) use ($selected, $selectedLength) {
|
||||||
return $list.
|
return $list.
|
||||||
($selectedLength > 2 && $index !== $selectedLength - 1? ', ' : ' ') .
|
($selectedLength > 2 ? ', ' : ' ') .
|
||||||
($index === $selectedLength - 1 ? 'or ' : '') .
|
($index === $selectedLength - 1 ? 'or ' : '') .
|
||||||
$selected[$index];
|
$selected[$index];
|
||||||
},
|
},
|
||||||
|
@ -47,7 +47,7 @@ class QuotedOrListTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testReturnsCommaSeparatedManyItemList()
|
public function testReturnsCommaSeparatedManyItemList()
|
||||||
{
|
{
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'"A", "B" or "C"',
|
'"A", "B", or "C"',
|
||||||
Utils::quotedOrList(['A', 'B', 'C'])
|
Utils::quotedOrList(['A', 'B', 'C'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ class QuotedOrListTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testLimitsToFiveItems()
|
public function testLimitsToFiveItems()
|
||||||
{
|
{
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
'"A", "B", "C", "D" or "E"',
|
'"A", "B", "C", "D", or "E"',
|
||||||
Utils::quotedOrList(['A', 'B', 'C', 'D', 'E', 'F'])
|
Utils::quotedOrList(['A', 'B', 'C', 'D', 'E', 'F'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -322,7 +322,7 @@ class FieldsOnCorrectTypeTest extends TestCase
|
|||||||
public function testLimitsLotsOfTypeSuggestions()
|
public function testLimitsLotsOfTypeSuggestions()
|
||||||
{
|
{
|
||||||
$expected = 'Cannot query field "f" on type "T". ' .
|
$expected = 'Cannot query field "f" on type "T". ' .
|
||||||
'Did you mean to use an inline fragment on "A", "B", "C", "D" or "E"?';
|
'Did you mean to use an inline fragment on "A", "B", "C", "D", or "E"?';
|
||||||
|
|
||||||
$this->assertEquals($expected, FieldsOnCorrectType::undefinedFieldMessage(
|
$this->assertEquals($expected, FieldsOnCorrectType::undefinedFieldMessage(
|
||||||
'f',
|
'f',
|
||||||
@ -338,7 +338,7 @@ class FieldsOnCorrectTypeTest extends TestCase
|
|||||||
public function testLimitsLotsOfFieldSuggestions()
|
public function testLimitsLotsOfFieldSuggestions()
|
||||||
{
|
{
|
||||||
$expected = 'Cannot query field "f" on type "T". ' .
|
$expected = 'Cannot query field "f" on type "T". ' .
|
||||||
'Did you mean "z", "y", "x", "w" or "v"?';
|
'Did you mean "z", "y", "x", "w", or "v"?';
|
||||||
|
|
||||||
$this->assertEquals($expected, FieldsOnCorrectType::undefinedFieldMessage(
|
$this->assertEquals($expected, FieldsOnCorrectType::undefinedFieldMessage(
|
||||||
'f',
|
'f',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user