|
1 | 1 | <?php |
2 | 2 | /** |
3 | | - * Copyright © Magento, Inc. All rights reserved. |
4 | | - * See COPYING.txt for license details. |
| 3 | + * Copyright 2014 Adobe |
| 4 | + * All rights reserved. |
5 | 5 | */ |
6 | 6 | declare(strict_types=1); |
7 | 7 |
|
@@ -115,6 +115,46 @@ public function testPublish() |
115 | 115 | $this->assertTrue($this->object->publish($this->getAsset())); |
116 | 116 | } |
117 | 117 |
|
| 118 | + public function testPublishWithSourceFileNewer() |
| 119 | + { |
| 120 | + $this->staticDirRead->expects($this->once()) |
| 121 | + ->method('isExist') |
| 122 | + ->with('some/file.ext') |
| 123 | + ->willReturn(true); |
| 124 | + $this->staticDirRead->expects($this->once()) |
| 125 | + ->method('stat') |
| 126 | + ->with('some/file.ext') |
| 127 | + ->willReturn(['mtime' => 1000]); |
| 128 | + |
| 129 | + $materializationStrategy = |
| 130 | + $this->getMockForAbstractClass(StrategyInterface::class); |
| 131 | + |
| 132 | + $this->materializationStrategyFactory->expects($this->once()) |
| 133 | + ->method('create') |
| 134 | + ->with($this->getAsset()) |
| 135 | + ->willReturn($materializationStrategy); |
| 136 | + $materializationStrategy->expects($this->once()) |
| 137 | + ->method('publishFile') |
| 138 | + ->with($this->sourceDirWrite, $this->staticDirWrite, 'file.ext', 'some/file.ext') |
| 139 | + ->willReturn(true); |
| 140 | + |
| 141 | + $this->assertTrue($this->object->publish($this->getAsset())); |
| 142 | + } |
| 143 | + |
| 144 | + public function testPublishWithSourceFileOlder() |
| 145 | + { |
| 146 | + $this->staticDirRead->expects($this->once()) |
| 147 | + ->method('isExist') |
| 148 | + ->with('some/file.ext') |
| 149 | + ->willReturn(true); |
| 150 | + $this->staticDirRead->expects($this->once()) |
| 151 | + ->method('stat') |
| 152 | + ->with('some/file.ext') |
| 153 | + ->willReturn(['mtime' => 0]); |
| 154 | + |
| 155 | + $this->assertTrue($this->object->publish($this->getAsset())); |
| 156 | + } |
| 157 | + |
118 | 158 | /** |
119 | 159 | * Create an asset mock |
120 | 160 | * |
|
0 commit comments