public function testMergeMtimeUnchanged() { $this->targetDir->expects($this->once())->method('isExist')->with('merged/result.txt.dat')->will($this->returnValue(true)); $this->targetDir->expects($this->once())->method('readFile')->with('merged/result.txt.dat')->will($this->returnValue('11')); $assets = $this->getAssetsToMerge(); $this->mergerMock->expects($this->never())->method('merge'); $this->targetDir->expects($this->never())->method('writeFile'); $this->checksum->merge($assets, $this->resultAsset); }
public function testIteratorInterfaceMerge() { $assets = [$this->assetJsOne, $this->assetJsTwo]; $this->logger->expects($this->never())->method('critical'); /** @var Merged $merged */ $merged = (new ObjectManager($this))->getObject(Merged::class, ['logger' => $this->logger, 'mergeStrategy' => $this->mergeStrategy, 'assetRepo' => $this->assetRepo, 'assets' => $assets]); $mergedAsset = $this->getMock('Magento\\Framework\\View\\Asset\\File', [], [], '', false); $this->mergeStrategy->expects($this->once())->method('merge')->with($assets, $mergedAsset)->willReturn(null); $this->assetRepo->expects($this->once())->method('createArbitrary')->willReturn($mergedAsset); $expectedResult = [$mergedAsset]; $this->assertIteratorEquals($expectedResult, $merged); $this->assertIteratorEquals($expectedResult, $merged); // ensure merging happens only once }
public function testMergeNotExists() { $this->dirMock->expects($this->once())->method('isExist')->with('foo/file')->will($this->returnValue(false)); $this->mergerMock->expects($this->once())->method('merge')->with([], $this->resultAsset); $this->fileExists->merge([], $this->resultAsset); }