ENH Update code to reflect changes in template layer

This commit is contained in:
Guy Sartorelli 2024-10-14 15:58:01 +13:00
parent e9378fc9be
commit fea447644a
No known key found for this signature in database

View File

@ -15,7 +15,8 @@ use Behat\Testwork\Suite\SuiteRepository;
use Exception; use Exception;
use SilverStripe\Core\Manifest\Module; use SilverStripe\Core\Manifest\Module;
use SilverStripe\Model\ArrayData; use SilverStripe\Model\ArrayData;
use SilverStripe\View\SSViewer; use SilverStripe\View\SSTemplateEngine;
use SilverStripe\View\ViewLayerData;
use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
@ -148,8 +149,8 @@ class ModuleInitialisationController implements Controller
); );
// Create dummy feature // Create dummy feature
$featureContent = ArrayData::create([]) $engine = SSTemplateEngine::create(__DIR__.'/../../templates/SkeletonFeature.ss');
->renderWith(__DIR__.'/../../templates/SkeletonFeature.ss'); $featureContent = $engine->render(ViewLayerData::create([]));
file_put_contents($fullPath.'/placeholder.feature', $featureContent); file_put_contents($fullPath.'/placeholder.feature', $featureContent);
} }
@ -184,7 +185,8 @@ class ModuleInitialisationController implements Controller
'Namespace' => $fullNamespace, 'Namespace' => $fullNamespace,
'ClassName' => $class, 'ClassName' => $class,
]); ]);
$classContent = $obj->renderWith(__DIR__.'/../../templates/FeatureContext.ss'); $engine = SSTemplateEngine::create(__DIR__.'/../../templates/FeatureContext.ss');
$classContent = $engine->render(ViewLayerData::create($obj));
file_put_contents($classPath ?? '', $classContent); file_put_contents($classPath ?? '', $classContent);
// Log // Log