/** * Get the Path from the name of the fixture * * @param string $name * @return string the path of fixture */ public function fixturePath($name) { return $this->loader->resolveName($name); }
<?php require_once __DIR__ . '/../vendor/autoload.php'; use holyshared\fixture\FileFixture; use holyshared\fixture\loader\TextLoader; use holyshared\fixture\container\LoaderContainer; use holyshared\fixture\container\FixtureContainer; use holyshared\fixture\factory\FixtureContainerFactory; $loaders = new LoaderContainer([new TextLoader()]); $fixtures = new FixtureContainer(['text:default:readme' => __DIR__ . '/README.md']); $fixture = new FileFixture($fixtures, $loaders); $content = $fixture->load('text:default:readme'); print $content;
<?php require_once __DIR__ . '/../vendor/autoload.php'; use holyshared\fixture\FileFixture; use holyshared\fixture\loader\TextLoader; use holyshared\fixture\loader\MustacheLoader; use holyshared\fixture\loader\ArtLoader; use holyshared\fixture\container\LoaderContainer; use holyshared\fixture\container\FixtureContainer; use holyshared\fixture\factory\FixtureContainerFactory; $loaders = new LoaderContainer([new ArtLoader(new MustacheLoader(new TextLoader()))]); $fixtures = new FixtureContainer(['art:default:header' => __DIR__ . '/art.txt']); $fixture = new FileFixture($fixtures, $loaders); $content = $fixture->load('art:default:header'); print $content;
<?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;