Exemplo n.º 1
0
 /**
  * Special case: collect resource helper references in PHP-code
  *
  * @param string $contents
  * @param array &$classes
  */
 protected function _collectResourceHelpersPhp($contents, &$classes)
 {
     $regex = '/(?:\\:\\:|\\->)getResourceHelper\\(\\s*\'([a-z\\d\\\\]+)\'\\s*\\)/ix';
     $matches = \Magento\TestFramework\Utility\Classes::getAllMatches($contents, $regex);
     foreach ($matches as $moduleName) {
         $classes[] = "{$moduleName}\\Model\\Resource\\Helper\\Mysql4";
     }
 }
Exemplo n.º 2
0
 public function testGetChildHtml()
 {
     $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this);
     $invoker(function ($file) {
         $result = \Magento\TestFramework\Utility\Classes::getAllMatches(file_get_contents($file), "/(->getChildHtml\\([^,()]+, ?[^,()]+,)/i");
         $this->assertEmpty($result, "3rd parameter is not needed anymore for getChildHtml() in '{$file}': " . print_r($result, true));
         $result = \Magento\TestFramework\Utility\Classes::getAllMatches(file_get_contents($file), "/(->getChildChildHtml\\([^,()]+, ?[^,()]+, ?[^,()]+,)/i");
         $this->assertEmpty($result, "4th parameter is not needed anymore for getChildChildHtml() in '{$file}': " . print_r($result, true));
     }, \Magento\TestFramework\Utility\Files::init()->getPhpFiles());
 }
Exemplo n.º 3
0
 /**
  * @return array
  */
 public function getChildBlockDataProvider()
 {
     $result = array();
     foreach (\Magento\TestFramework\Utility\Files::init()->getPhpFiles(true, false, true, false) as $file) {
         $aliases = \Magento\TestFramework\Utility\Classes::getAllMatches(file_get_contents($file), '/\\->getChildBlock\\(\'([^\']+)\'\\)/x');
         foreach ($aliases as $alias) {
             $result[$file] = array($alias, $file);
         }
     }
     return $result;
 }