コード例 #1
0
 public function onStart()
 {
     $textLoader = new CacheLoader(new TextLoader());
     $mustacheLoader = new MustacheLoader($textLoader);
     $artLoader = new ArtLoader($mustacheLoader);
     $loaders = new LoaderContainer([$textLoader, $mustacheLoader, $artLoader]);
     $factory = new FixtureContainerFactory();
     $fixtures = $factory->createFromFile($this->configFile);
     $fixture = new FileFixture($fixtures, $loaders);
     $this->scope = new FileFixtureScope($fixture);
     return $this;
 }
コード例 #2
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use holyshared\fixture\FileFixture;
use holyshared\fixture\loader\TextLoader;
use holyshared\fixture\loader\MustacheLoader;
use holyshared\fixture\container\LoaderContainer;
use holyshared\fixture\container\FixtureContainer;
use holyshared\fixture\factory\FixtureContainerFactory;
$textLoader = new TextLoader();
$loaders = new LoaderContainer([$textLoader, new MustacheLoader($textLoader)]);
$factory = new FixtureContainerFactory();
$fixtures = $factory->createFromFile(__DIR__ . '/fixtures.toml');
$fixture = new FileFixture($fixtures, $loaders);
$content = $fixture->load('mustache:default:successMessage', ['name' => 'build']);
print $content;