-
Notifications
You must be signed in to change notification settings - Fork 11.3k
/
Copy pathFoundationHelpersTest.php
60 lines (46 loc) · 1.5 KB
/
FoundationHelpersTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace Illuminate\Tests\Foundation;
use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Foundation\Application;
class FoundationHelpersTest extends TestCase
{
public function tearDown()
{
m::close();
}
public function testCache()
{
$app = new Application;
$app['cache'] = $cache = m::mock('stdClass');
// 1. cache()
$this->assertInstanceOf('stdClass', cache());
// 2. cache(['foo' => 'bar'], 1);
$cache->shouldReceive('put')->once()->with('foo', 'bar', 1);
cache(['foo' => 'bar'], 1);
// 3. cache('foo');
$cache->shouldReceive('get')->once()->andReturn('bar');
$this->assertEquals('bar', cache('foo'));
// 4. cache('baz', 'default');
$cache->shouldReceive('get')->once()->with('baz', 'default')->andReturn('default');
$this->assertEquals('default', cache('baz', 'default'));
}
/**
* @expectedException \Exception
* @expectedExceptionMessage You must specify an expiration time when setting a value in the cache.
*/
public function testCacheThrowsAnExceptionIfAnExpirationIsNotProvided()
{
cache(['foo' => 'bar']);
}
public function testUnversionedElixir()
{
$file = 'unversioned.css';
app()->singleton('path.public', function () {
return __DIR__;
});
touch(public_path($file));
$this->assertEquals('/'.$file, elixir($file));
unlink(public_path($file));
}
}