Skip to content

Commit eae97bd

Browse files
committed
MAGETWO-86323: Create XSD tests
1 parent 8085c1c commit eae97bd

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

app/code/Magento/GraphQl/Test/Unit/Model/Config/XsdTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,25 @@
77

88
class XsdTest extends \PHPUnit\Framework\TestCase
99
{
10-
1110
/**
1211
* Path to xsd schema file
1312
* @var string
1413
*/
15-
protected $_xsdSchema;
14+
private $xsdSchema;
1615

1716
/**
1817
* @var \Magento\Framework\TestFramework\Unit\Utility\XsdValidator
1918
*/
20-
protected $_xsdValidator;
19+
private $xsdValidator;
2120

2221
protected function setUp()
2322
{
2423
if (!function_exists('libxml_set_external_entity_loader')) {
2524
$this->markTestSkipped('Skipped on HHVM. Will be fixed in MAGETWO-45033');
2625
}
2726
$urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
28-
$this->_xsdSchema = $urnResolver->getRealPath('urn:magento:module:Magento_GraphQl:etc/graphql.xsd');
29-
$this->_xsdValidator = new \Magento\Framework\TestFramework\Unit\Utility\XsdValidator();
27+
$this->xsdSchema = $urnResolver->getRealPath('urn:magento:module:Magento_GraphQl:etc/graphql.xsd');
28+
$this->xsdValidator = new \Magento\Framework\TestFramework\Unit\Utility\XsdValidator();
3029
}
3130

3231
/**
@@ -36,14 +35,14 @@ protected function setUp()
3635
*/
3736
public function testSchemaCorrectlyIdentifiesInvalidXml($xmlString, $expectedError)
3837
{
39-
$actualError = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString);
38+
$actualError = $this->xsdValidator->validate($this->xsdSchema, $xmlString);
4039
$this->assertEquals($expectedError, $actualError);
4140
}
4241

4342
public function testSchemaCorrectlyIdentifiesValidXml()
4443
{
4544
$xmlString = file_get_contents(__DIR__ . '/_files/graphql_simple_configurable.xml');
46-
$actualResult = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString);
45+
$actualResult = $this->xsdValidator->validate($this->xsdSchema, $xmlString);
4746
$this->assertEmpty($actualResult);
4847
}
4948

app/code/Magento/GraphQl/Test/Unit/Model/Config/_files/invalidGraphQlXmlArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
<argument xsi:type="SortArgument" name="Sort"/></field>
182182
</type></config>',
183183
[
184-
"Element 'argument': The attribute 'baseType' is required but missing.\nLine: 7\n"
184+
"Element 'argument': The attribute 'baseType' is required but missing.\nLine: 11\n"
185185
],
186186
],
187187
'invalid_argument_FilterArgument_with missing baseType attribute' => [

dev/tests/integration/testsuite/Magento/Framework/GraphQl/Config/ConverterTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ class ConverterTest extends \PHPUnit\Framework\TestCase
1010
/**
1111
* @var \Magento\Framework\GraphQl\Config\Converter
1212
*/
13-
protected $graphQlConverter;
13+
private $graphQlConverter;
1414

1515
/**
1616
* @var \DOMDocument
1717
*/
18-
protected $source;
18+
private $source;
1919

2020
protected function setUp()
2121
{
@@ -27,10 +27,8 @@ protected function setUp()
2727
/**
2828
* @return void
2929
*/
30-
3130
public function testConvert()
3231
{
33-
$actualOutput = [];
3432
$this->source= new \DOMDocument();
3533
$this->source->load(__DIR__ . '../../_files/input_graphql.xml');
3634
$actualOutput = $this->graphQlConverter->convert($this->source);

dev/tests/integration/testsuite/Magento/Framework/GraphQl/_files/output_graphql.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66
return [
7-
87
[
98
"Query" =>
109
[
@@ -132,5 +131,4 @@
132131
]
133132

134133
]
135-
136134
];

0 commit comments

Comments
 (0)