コード例 #1
0
 protected function setUp()
 {
     $om = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager();
     $this->fallback = $om->get('Magento\\Framework\\View\\Design\\FileResolution\\Fallback\\StaticFile');
     $this->explicitFallback = $om->get('Magento\\Framework\\View\\Design\\FileResolution\\Fallback\\Resolver\\Simple');
     $this->themeRepo = $om->get('Magento\\Framework\\View\\Design\\Theme\\FlyweightFactory');
     $this->design = $om->get('Magento\\Framework\\View\\DesignInterface');
 }
コード例 #2
0
 public function testAllTemplates()
 {
     $invoker = new \Magento\TestFramework\Utility\AggregateInvoker($this);
     $invoker(function ($module, $template, $class, $area) {
         \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\DesignInterface')->setDefaultDesignTheme();
         // intentionally to make sure the module files will be requested
         $params = array('area' => $area, 'themeModel' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\View\\Design\\ThemeInterface'), 'module' => $module);
         $file = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager()->get('Magento\\Framework\\View\\FileSystem')->getTemplateFileName($template, $params);
         $this->assertFileExists($file, "Block class: {$class}");
     }, $this->allTemplatesDataProvider());
 }
コード例 #3
0
 /**
  * Note that data provider is not used in conventional way in order to not overwhelm test statistics
  */
 public function testTemplates()
 {
     $invalidTemplates = [];
     foreach ($this->templatesDataProvider() as $template) {
         list($area, $themeId, $module, $file, $xml) = $template;
         $params = ['area' => $area, 'themeId' => $themeId, 'module' => $module];
         try {
             $templateFilename = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager()->get('Magento\\Framework\\View\\FileSystem')->getTemplateFileName($file, $params);
             $this->assertFileExists($templateFilename);
         } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
             $invalidTemplates[] = "File \"{$templateFilename}\" does not exist." . PHP_EOL . "Parameters: {$area}/{$themeId} {$module}::{$file}" . PHP_EOL . 'Layout update: ' . $xml;
         }
     }
     $this->assertEmpty($invalidTemplates, "Invalid templates found:\n\n" . implode("\n-----\n", $invalidTemplates));
 }
コード例 #4
0
 /**
  * Note that data provider is not used in conventional way in order to not overwhelm test statistics
  */
 public function testTemplates()
 {
     $invalidTemplates = array();
     foreach ($this->templatesDataProvider() as $template) {
         list($area, $themeId, $module, $file, $xml) = $template;
         if ($area === 'frontend' && in_array($module . '::' . $file, array('Magento_Reports::Magento_Catalog::product/list/items.phtml', 'Magento_Review::redirect.phtml', 'Magento_Theme::blank.phtml'))) {
             continue;
             // $this->markTestIncomplete('MAGETWO-9806');
         }
         $params = array('area' => $area, 'themeId' => $themeId, 'module' => $module);
         try {
             $templateFilename = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager()->get('Magento\\Framework\\View\\FileSystem')->getTemplateFileName($file, $params);
             $this->assertFileExists($templateFilename);
         } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
             $invalidTemplates[] = "File \"{$templateFilename}\" does not exist." . PHP_EOL . "Parameters: {$area}/{$themeId} {$module}::{$file}" . PHP_EOL . 'Layout update: ' . $xml;
         }
     }
     $this->assertEmpty($invalidTemplates, "Invalid templates found:\n\n" . implode("\n-----\n", $invalidTemplates));
 }
コード例 #5
0
 /**
  * @dataProvider widgetPlaceholderImagesDataProvider
  */
 public function testWidgetPlaceholderImages($skinImage)
 {
     /** @var \Magento\Framework\View\Asset\Repository $assetRepo */
     $assetRepo = \Magento\TestFramework\Helper\Bootstrap::getObjectmanager()->get('Magento\\Framework\\View\\Asset\\Repository');
     $this->assertFileExists($assetRepo->createAsset($skinImage, ['area' => 'adminhtml'])->getSourceFile());
 }