function it_recompiles_source_if_checksum_is_different(StorageInterface $storage, SourceInterface $source, ReferenceInterface $reference, ReferenceInterface $newReference) { $reference->getChecksum()->willReturn('123'); $source->getChecksum()->willReturn('111'); $storage->find($source)->willReturn($reference); $storage->store($source)->willReturn($newReference); $this->compile($source)->shouldReturn($newReference); }
/** * Returns dispersed reference file path * * @param ReferenceInterface $reference * @param null|string $dispersion * * @return string */ private function getReferenceFilePath(ReferenceInterface $reference, $dispersion = null) { if ($dispersion === null) { $dispersion = $this->dispersion->calculate($reference->getId()); } return sprintf('%s/%s/%s.php', $this->filePath, $dispersion, $reference->getId()); }
function it_returns_exportable_instance(ReferenceInterface $one, ReferenceInterface $two, ReferenceInterface $three) { $this->beConstructedWith(['one' => $one, 'two' => $two, 'three' => $three]); $this->export()->shouldReturn(['data' => ['one' => $one->getWrappedObject(), 'two' => $two->getWrappedObject(), 'three' => $three->getWrappedObject()]]); }
function it_should_be_possible_to_specify_custom_class_for_factory(ReferenceInterface $index, SourceInterface $source) { $indexClass = get_class($index->getWrappedObject()); $this->beConstructedWith($indexClass); $this->create($source)->shouldImplement($indexClass); }