ConfigTest.php 2.01 KB
Newer Older
Ketan's avatar
Ketan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace Magento\Test\Integrity\App\Language;

class ConfigTest extends \Magento\TestFramework\Integrity\AbstractConfig
{
    public function testSchemaUsingInvalidXml($expectedErrors = null)
    {
        $expectedErrors = [
            "Element 'code': [facet 'pattern'] The value 'e_GB' is not accepted by the pattern",
            "Element 'code': 'e_GB' is not a valid value of the atomic type 'codeType'",
            "Element 'vendor': [facet 'pattern'] The value 'Magento1' is not accepted by the pattern",
            "Element 'vendor': 'Magento1' is not a valid value of the atomic type",
            "Element 'sort_odrer': This element is not expected. Expected is",
        ];
        parent::testSchemaUsingInvalidXml($expectedErrors);
    }

    /**
     * Returns the name of the XSD file to be used to validate the XML
     *
     * @return string
     */
    protected function _getXsd()
    {
        $urnResolver = new \Magento\Framework\Config\Dom\UrnResolver();
        return $urnResolver->getRealPath('urn:magento:framework:App/Language/package.xsd');
    }

    /**
     * The location of a single valid complete xml file
     *
     * @return string
     */
    protected function _getKnownValidXml()
    {
        return __DIR__ . '/_files/known_valid.xml';
    }

    /**
     * The location of a single known invalid complete xml file
     *
     * @return string
     */
    protected function _getKnownInvalidXml()
    {
        return __DIR__ . '/_files/known_invalid.xml';
    }

    /**
     * {@inheritdoc}
     */
    protected function _getKnownValidPartialXml()
    {
        return;
    }

    /**
     * {@inheritdoc}
     */
    protected function _getFileXsd()
    {
        return;
    }

    /**
     * {@inheritdoc}
     */
    protected function _getKnownInvalidPartialXml()
    {
        return;
    }

    /**
     * {@inheritdoc}
     */
    protected function _getXmlName()
    {
        return;
    }
}