Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 2
0
 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
 }
Ejemplo n.º 3
0
 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);
 }