![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/framework/Config/Test/Unit/Dom/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Framework\Config\Test\Unit\Dom; use Magento\Framework\Config\Dom\NodePathMatcher; use PHPUnit\Framework\TestCase; class NodePathMatcherTest extends TestCase { /** * @var NodePathMatcher */ protected $_model; protected function setUp(): void { $this->_model = new NodePathMatcher(); } /** * @param string $pathPattern * @param string $xpathSubject * @param boolean $expectedResult * * @dataProvider getNodeInfoDataProvider */ public function testMatch($pathPattern, $xpathSubject, $expectedResult) { $actualResult = $this->_model->match($pathPattern, $xpathSubject); $this->assertSame($expectedResult, $actualResult); } /** * @return array */ public function getNodeInfoDataProvider() { return [ 'no match' => ['/root/node', '/root', false], 'partial match' => ['/root/node', '/wrapper/root/node', false], 'exact match' => ['/root/node', '/root/node', true], 'regexp match' => ['/root/node/(sub-)+node', '/root/node/sub-node', true], 'match with namespace' => ['/root/node', '/mage:root/node', true], 'match with predicate' => ['/root/node', '/root/node[@name="test"]', true] ]; } }