/** * 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"; } }
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()); }
/** * @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; }