Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 /**
  * 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());
 }
Exemplo n.º 3
0
 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()]]);
 }
Exemplo n.º 4
0
 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);
 }