Skip to content

Commit b98281b

Browse files
committed
fix conflicts
2 parents 5ae802f + d9ed009 commit b98281b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/Illuminate/View/Compilers/Compiler.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Illuminate\View\Compilers;
44

5+
use InvalidArgumentException;
56
use Illuminate\Filesystem\Filesystem;
67

78
abstract class Compiler
@@ -26,9 +27,15 @@ abstract class Compiler
2627
* @param \Illuminate\Filesystem\Filesystem $files
2728
* @param string $cachePath
2829
* @return void
30+
*
31+
* @throws \InvalidArgumentException
2932
*/
3033
public function __construct(Filesystem $files, $cachePath)
3134
{
35+
if (! $cachePath) {
36+
throw new InvalidArgumentException('Please provide a valid cache path.');
37+
}
38+
3239
$this->files = $files;
3340
$this->cachePath = $cachePath;
3441
}
@@ -57,7 +64,7 @@ public function isExpired($path)
5764
// If the compiled file doesn't exist we will indicate that the view is expired
5865
// so that it can be re-compiled. Else, we will verify the last modification
5966
// of the views is less than the modification times of the compiled views.
60-
if (! $this->cachePath || ! $this->files->exists($compiled)) {
67+
if (! $this->files->exists($compiled)) {
6168
return true;
6269
}
6370

tests/View/ViewBladeCompilerTest.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ public function testIsExpiredReturnsTrueIfCompiledFileDoesntExist()
1717
$this->assertTrue($compiler->isExpired('foo'));
1818
}
1919

20-
public function testIsExpiredReturnsTrueIfCachePathIsNull()
20+
/**
21+
* @expectedException \InvalidArgumentException
22+
*/
23+
public function testCannotConstructWithBadCachePath()
2124
{
22-
$compiler = new BladeCompiler($files = $this->getFiles(), null);
23-
$files->shouldReceive('exists')->never();
24-
$this->assertTrue($compiler->isExpired('foo'));
25+
new BladeCompiler($this->getFiles(), null);
2526
}
2627

2728
public function testIsExpiredReturnsTrueWhenModificationTimesWarrant()
@@ -75,14 +76,6 @@ public function testCompileWithPathSetBefore()
7576
$this->assertEquals('foo', $compiler->getPath());
7677
}
7778

78-
public function testCompileDoesntStoreFilesWhenCachePathIsNull()
79-
{
80-
$compiler = new BladeCompiler($files = $this->getFiles(), null);
81-
$files->shouldReceive('get')->never();
82-
$files->shouldReceive('put')->never();
83-
$compiler->compile('foo');
84-
}
85-
8679
public function testEchosAreCompiled()
8780
{
8881
$compiler = new BladeCompiler($this->getFiles(), __DIR__);

0 commit comments

Comments
 (0)