示例#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 = Classes::getAllMatches($contents, $regex);
     foreach ($matches as $moduleName) {
         $classes[] = "{$moduleName}\\Model\\ResourceModel\\Helper\\Mysql4";
     }
 }
 public function testGetChildHtml()
 {
     $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
     $invoker(function ($file) {
         $result = \Magento\Framework\App\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\Framework\App\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));
     }, Files::init()->getPhpFiles(Files::INCLUDE_APP_CODE | Files::INCLUDE_PUB_CODE | Files::INCLUDE_LIBS | Files::INCLUDE_TEMPLATES | Files::INCLUDE_TESTS | Files::AS_DATA_SET | Files::INCLUDE_NON_CLASSES));
 }
 public function testGetChildHtml()
 {
     $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
     $invoker(function ($file) {
         $result = \Magento\Framework\App\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\Framework\App\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\Framework\App\Utility\Files::init()->getPhpFiles());
 }
示例#4
0
 /**
  * @return array
  */
 public function getChildBlockDataProvider()
 {
     $result = [];
     foreach (Files::init()->getPhpFiles(true, false, true, false, false) as $file) {
         $aliases = \Magento\Framework\App\Utility\Classes::getAllMatches(file_get_contents($file), '/\\->getChildBlock\\(\'([^\']+)\'\\)/x');
         foreach ($aliases as $alias) {
             $result[$file] = [$alias, $file];
         }
     }
     return $result;
 }
 /**
  * @return array
  */
 public function getChildBlockDataProvider()
 {
     $result = [];
     $collectedFiles = Files::init()->getPhpFiles(Files::INCLUDE_APP_CODE | Files::INCLUDE_TEMPLATES | Files::INCLUDE_NON_CLASSES);
     foreach ($collectedFiles as $file) {
         $aliases = \Magento\Framework\App\Utility\Classes::getAllMatches(file_get_contents($file), '/\\->getChildBlock\\(\'([^\']+)\'\\)/x');
         foreach ($aliases as $alias) {
             $result[$file] = [$alias, $file];
         }
     }
     return $result;
 }