11<?php
22
33use Mockery as m ;
4+ use Illuminate \Foundation \Application ;
45use Ipalaus \Geonames \Importer ;
56use Ipalaus \Geonames \Commands \ImportCommand ;
67
@@ -12,6 +13,10 @@ class ImportCommandTest extends PHPUnit_Framework_TestCase {
1213 public function testDevelopmentAndCountryCantBeBothOptions ()
1314 {
1415 $ command = new ImportCommandTestStub (new Importer ($ this ->getRepo ()), $ this ->getFiles (), array ());
16+
17+ $ app = new Application ();
18+ $ command ->setLaravel ($ app );
19+
1520 $ this ->runCommand ($ command , array ('--development ' => true , '--country ' => 'IP ' ));
1621 }
1722
@@ -21,6 +26,10 @@ public function testDevelopmentAndCountryCantBeBothOptions()
2126 public function testMustProvideAValidIsoAlpha2Country ()
2227 {
2328 $ command = new ImportCommandTestStub (new Importer ($ this ->getRepo ()), $ this ->getFiles (), array ());
29+
30+ $ app = new Application ();
31+ $ command ->setLaravel ($ app );
32+
2433 $ this ->runCommand ($ command , array ('--country ' => 'Isern ' ));
2534 }
2635
@@ -78,6 +87,9 @@ public function testCommandCall()
7887
7988 $ command = $ this ->getMock ('ImportCommandTestStub ' , $ mockedMethods , array ($ importer , $ filesystem , $ config ));
8089
90+ $ app = new Application ();
91+ $ command ->setLaravel ($ app );
92+
8193 $ filesystem ->shouldReceive ('isDirectory ' )->once ()->andReturn (false );
8294 $ filesystem ->shouldReceive ('makeDirectory ' )->once ()->andReturn (true );
8395 $ filesystem ->shouldReceive ('runProcess ' )->andReturn (null );
@@ -114,6 +126,9 @@ public function testCommandAllFilesExistsCall()
114126
115127 $ command = $ this ->getMock ('ImportCommandTestStub ' , $ mockedMethods , array ($ importer , $ filesystem , $ config ));
116128
129+ $ app = new Application ();
130+ $ command ->setLaravel ($ app );
131+
117132 $ filesystem ->shouldReceive ('isDirectory ' )->once ()->andReturn (false );
118133 $ filesystem ->shouldReceive ('makeDirectory ' )->once ()->andReturn (true );
119134 $ filesystem ->shouldReceive ('runProcess ' )->andReturn (null );
@@ -147,6 +162,9 @@ public function testFetchOnlyOptionCall()
147162
148163 $ command = $ this ->getMock ('ImportCommandTestStub ' , $ mockedMethods , array ($ importer , $ filesystem , $ config ));
149164
165+ $ app = new Application ();
166+ $ command ->setLaravel ($ app );
167+
150168 $ filesystem ->shouldReceive ('isDirectory ' )->once ()->andReturn (false );
151169 $ filesystem ->shouldReceive ('makeDirectory ' )->once ()->andReturn (true );
152170
@@ -183,6 +201,9 @@ public function testDevelopmentOptionCall()
183201
184202 $ command = $ this ->getMock ('ImportCommandTestStub ' , $ mockedMethods , array ($ importer , $ filesystem , $ config ));
185203
204+ $ app = new Application ();
205+ $ command ->setLaravel ($ app );
206+
186207 $ filesystem ->shouldReceive ('isDirectory ' )->once ()->andReturn (false );
187208 $ filesystem ->shouldReceive ('makeDirectory ' )->once ()->andReturn (true );
188209 $ filesystem ->shouldReceive ('runProcess ' )->andReturn (null );
@@ -220,6 +241,9 @@ public function testCountryOptionCall()
220241
221242 $ command = $ this ->getMock ('ImportCommandTestStub ' , $ mockedMethods , array ($ importer , $ filesystem , $ config ));
222243
244+ $ app = new Application ();
245+ $ command ->setLaravel ($ app );
246+
223247 $ filesystem ->shouldReceive ('isDirectory ' )->once ()->andReturn (false );
224248 $ filesystem ->shouldReceive ('makeDirectory ' )->once ()->andReturn (true );
225249 $ filesystem ->shouldReceive ('runProcess ' )->andReturn (null );
0 commit comments