Example #1
0
 /**
  * @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(array(), $actualResult);
 }
Example #2
0
 public function testInvalidXml()
 {
     $xmlFile = realpath(__DIR__ . '/_files/invalid.xml');
     $expected = array("Element 'block', attribute 'type': The attribute 'type' is not allowed.", "Element 'actions': This element is not expected. Expected is ( property ).");
     $xmlString = file_get_contents($xmlFile);
     $this->assertEquals($expected, $this->_validator->validate($this->_xsdSchema, $xmlString));
 }
Example #3
0
 public function testSchemaCorrectlyIdentifiesValidXml()
 {
     $xmlString = file_get_contents(__DIR__ . '/_files/valid_acl.xml');
     $actualResult = $this->_xsdValidator->validate($this->_xsdSchema, $xmlString);
     $this->assertEmpty($actualResult);
 }