Example #1
0
 /**
  * @dataProvider templateOptions
  */
 public function testCompiledTemplate($templateOptions)
 {
     $container = new \Mockery\Container();
     $faker = \Faker\Factory::create();
     $filePath = $this->workingPath . DS . $faker->lexify . '.' . $faker->fileExtension;
     /**
      * @var $template AbstractTemplate
      */
     $template = $container->mock($templateOptions['template'])->shouldDeferMissing()->shouldAllowMockingProtectedMethods();
     $template->shouldReceive('getDefaultTemplateData')->atLeast(1)->andReturn($templateOptions['defaultTemplateData']);
     $template->setTemplateData($templateOptions['templateData']);
     $template->setFilePath($filePath);
     $generator = new Generator($template);
     $generator->setAbsolutePath(__DIR__ . DS . 'fixtures');
     $this->assertEquals($templateOptions['stub'], $generator->getCompiledTemplate());
     $generator->make();
     $this->assertFileExists($filePath);
 }