/** * 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_creates_new_dispersion_directory_and_new_index_if_unknown_one_specified() { $this->dispersion->calculate(Argument::any())->willReturn('new_directory'); $source = $this->newSource('unknown', 'checksum1', [new ReturnStatement(true)]); $newReference = $this->store($source); $newReference->shouldImplement('EcomDev\\Compiler\\Storage\\ReferenceInterface'); $this->find($source)->shouldReturn($newReference); $storageFilePath = $this->vfs->url() . '/directory/new_directory/unknown.php'; $this->shouldHaveFileContent($storageFilePath, '<?php ' . PHP_EOL . 'return true;'); }