This repository has been archived by the owner on Mar 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OptimizeServiceProviderTest.php
72 lines (60 loc) · 1.82 KB
/
OptimizeServiceProviderTest.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
61
62
63
64
65
66
67
68
69
70
71
72
<?php namespace Orchestra\Optimize\TestCase;
use Mockery as m;
use Illuminate\Container\Container;
use Orchestra\Optimize\OptimizeServiceProvider;
class OptimizeServiceProviderTest extends \PHPUnit_Framework_TestCase
{
/**
* Application instance.
*
* @var \Illuminate\Container\Container
*/
protected $app;
/**
* Setup the test environment.
*/
public function setUp()
{
$this->app = new Container;
}
/**
* Teardown the test environment.
*/
public function tearDown()
{
unset($this->app);
m::close();
}
/**
* Test Orchestra\Optimize\OptimizeServiceProvider::register() method.
*
* @test
*/
public function testRegisterMethod()
{
$app = $this->app;
$app['config'] = $config = m::mock('\Illuminate\Config\Repository');
$app['events'] = $events = m::mock('\Illuminate\Events\Dispatcher');
$app['files'] = $files = m::mock('\Illuminate\Filesystem\Filesystem');
$app['path.base'] = '/var/www/laravel';
$files->shouldReceive('getRequire')->once()->andReturn(array());
$events->shouldReceive('listen')->once()->with('artisan.start', m::type('Closure'))->andReturn(null);
$stub = new OptimizeServiceProvider($app);
$stub->register();
$this->assertInstanceOf('\Orchestra\Optimize\OptimizeCommand', $app['orchestra.commands.optimize']);
}
/**
* Test Orchestra\Optimize\OptimizeServiceProvider::provides() method.
*
* @test
*/
public function testProvidesMethod()
{
$stub = new OptimizeServiceProvider($this->app);
$expected = array(
'orchestra.commands.optimize',
'orchestra.optimize',
);
$this->assertEquals($expected, $stub->provides());
}
}