These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * This file is part of phpDocumentor. |
||
4 | * |
||
5 | * For the full copyright and license information, please view the LICENSE |
||
6 | * file that was distributed with this source code. |
||
7 | * |
||
8 | * @copyright 2010-2016 Mike van Riel<[email protected]> |
||
9 | * @license http://www.opensource.org/licenses/mit-license.php MIT |
||
10 | * @link http://phpdoc.org |
||
11 | */ |
||
12 | |||
13 | namespace phpDocumentor\Application; |
||
14 | |||
15 | use Mockery as m; |
||
16 | use Symfony\Component\Console\Application as ConsoleApplication; |
||
17 | |||
18 | /** |
||
19 | * @coversDefaultClass phpDocumentor\Application\Application |
||
20 | * @covers ::<private> |
||
21 | */ |
||
22 | final class ApplicationTest extends \PHPUnit_Framework_TestCase |
||
23 | { |
||
24 | /** |
||
25 | * @test |
||
26 | * @covers ::__construct |
||
27 | */ |
||
28 | public function itShouldUseTheSystemTimeZone() |
||
29 | { |
||
30 | ini_set('date.timezone', 'Europe/Amsterdam'); |
||
31 | new Application(); |
||
32 | |||
33 | $this->assertSame('Europe/Amsterdam', date_default_timezone_get()); |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @test |
||
38 | * @covers ::__construct |
||
39 | */ |
||
40 | public function itShouldSetADefaultTimeZoneIfNoneIsPresent() |
||
41 | { |
||
42 | @ini_set('date.timezone', false); |
||
0 ignored issues
–
show
|
|||
43 | new Application(); |
||
44 | |||
45 | $this->assertSame('UTC', date_default_timezone_get()); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @test |
||
50 | * @covers ::__construct |
||
51 | */ |
||
52 | public function itShouldRemoveTheMemoryLimit() |
||
53 | { |
||
54 | ini_set('memory_limit', 500); |
||
55 | new Application(); |
||
56 | $this->assertSame('-1', ini_get('memory_limit')); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @test |
||
61 | * @covers ::__construct |
||
62 | */ |
||
63 | public function itShouldDisableGarbageCollection() |
||
64 | { |
||
65 | gc_enable(); |
||
66 | new Application(); |
||
67 | $this->assertFalse(gc_enabled()); |
||
68 | } |
||
69 | |||
70 | /** |
||
71 | * @test |
||
72 | * @covers ::run |
||
73 | */ |
||
74 | public function itShouldStartTheConsoleApplicationWhenRan() |
||
75 | { |
||
76 | $consoleApplication = m::mock(ConsoleApplication::class); |
||
77 | $consoleApplication->shouldReceive('setAutoExit')->once()->with(false); |
||
78 | $consoleApplication->shouldReceive('run')->once(); |
||
79 | |||
80 | $application = new Application([], [[ConsoleApplication::class => $consoleApplication]]); |
||
81 | $application->run(); |
||
82 | } |
||
83 | } |
||
84 |
If you suppress an error, we recommend checking for the error condition explicitly: