public function test() { $loader = new ResourceLoader(); $definitions = new Definition($loader->load($this->source)); foreach ($definitions->getExpectations() as $definition) { if (null !== $definition['type']) { $actual = $loader->getType($definition['uri']); if ($actual !== $definition['type']) { throw new FailedExpectationException("Type mismatch for {$definition['uri']}. Got [{$actual}] but expected [{$definition['type']}]"); } } $expectation = new Expectation($definition['expected']); if (!$expectation->assert($loader->load($definition['uri']))) { throw new FailedExpectationException(implode("\n", $expectation->getMessages())); } } return true; }
/** * @param string $type * @param string $identifier * @return Object */ public function persist($type, $identifier) { $class = $this->resolver->getClassForType($type); $args = $this->loader->load($type, $identifier); return $this->factory->buildPersistedObject($class, $type, $args); }