/** * @param string $schemaName * @param string $validFileName * @dataProvider schemaCorrectlyIdentifiesValidXmlDataProvider */ public function testSchemaCorrectlyIdentifiesValidXml($schemaName, $validFileName) { $xmlString = file_get_contents(__DIR__ . '/_files/' . $validFileName); $schemaPath = $this->_xsdSchemaPath . $schemaName; $actualResult = $this->_xsdValidator->validate($schemaPath, $xmlString); $this->assertEquals([], $actualResult); }
public function testInvalidXml() { $xmlFile = realpath(__DIR__ . '/_files/invalid.xml'); $expected = ["Element 'block', attribute 'type': The attribute 'type' is not allowed.\nLine: 9\n", "Element 'actions': This element is not expected. Expected is ( property ).\nLine: 10\n"]; $xmlString = file_get_contents($xmlFile); $this->assertEquals($expected, $this->_validator->validate($this->_xsdSchema, $xmlString)); }
public function testSchemaCorrectlyIdentifiesValidXml() { $xmlString = file_get_contents(__DIR__ . '/_files/valid_resources.xml'); $actualResult = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString); $this->assertEmpty($actualResult); }
public function testSchemaCorrectlyIdentifiesValidXml() { $xmlString = file_get_contents(__DIR__ . '/_files/types_valid.xml'); $actualResult = $this->_xsdValidator->validate($this->_typesXsdSchema, $xmlString); $this->assertEmpty($actualResult, join("\n", $actualResult)); }