Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NodePathMatcherTest.php
Go to the documentation of this file.
1 <?php
7 
8 use \Magento\Framework\Config\Dom\NodePathMatcher;
9 
10 class NodePathMatcherTest extends \PHPUnit\Framework\TestCase
11 {
15  protected $_model;
16 
17  protected function setUp()
18  {
19  $this->_model = new NodePathMatcher();
20  }
21 
29  public function testMatch($pathPattern, $xpathSubject, $expectedResult)
30  {
31  $actualResult = $this->_model->match($pathPattern, $xpathSubject);
32  $this->assertSame($expectedResult, $actualResult);
33  }
34 
38  public function getNodeInfoDataProvider()
39  {
40  return [
41  'no match' => ['/root/node', '/root', false],
42  'partial match' => ['/root/node', '/wrapper/root/node', false],
43  'exact match' => ['/root/node', '/root/node', true],
44  'regexp match' => ['/root/node/(sub-)+node', '/root/node/sub-node', true],
45  'match with namespace' => ['/root/node', '/mage:root/node', true],
46  'match with predicate' => ['/root/node', '/root/node[@name="test"]', true]
47  ];
48  }
49 }
$pathPattern
testMatch($pathPattern, $xpathSubject, $expectedResult)