diff --git a/.travis.yml b/.travis.yml index 44f9a4e..afb85a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 5.4 - 5.5 - 5.6 @@ -11,4 +10,4 @@ before_script: script: phpunit -c phpunit.xml --coverage-text after_script: - - php vendor/bin/coveralls -v \ No newline at end of file + - php vendor/bin/coveralls -v diff --git a/composer.json b/composer.json index e2840ab..f213d62 100644 --- a/composer.json +++ b/composer.json @@ -25,6 +25,7 @@ "symfony/process": "2.8.*|3.0.*" }, "require-dev": { + "laravel/framework": ">=5.1.0", "mockery/mockery": "~0.9.2", "phpunit/phpunit": "~4.1" }, diff --git a/src/Commands/ImportCommand.php b/src/Commands/ImportCommand.php index 4e446da..5a65353 100644 --- a/src/Commands/ImportCommand.php +++ b/src/Commands/ImportCommand.php @@ -250,7 +250,7 @@ protected function seedCommand($class, $extra = '') */ protected function makeProcess($command) { - return new Process($command, $this->laravel['path.base'], null, null, 0); + return new Process($command, $this->laravel->basePath(), null, null, 0); } /** diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php index ce82964..ea0e648 100644 --- a/src/Commands/InstallCommand.php +++ b/src/Commands/InstallCommand.php @@ -30,7 +30,7 @@ public function fire() { $force = $this->input->getOption('force'); - $path = $this->laravel['path.base'].'/app/config/packages/ipalaus/geonames/config.php'; + $path = $this->laravel->basePath().'/app/config/packages/ipalaus/geonames/config.php'; // prevents config overwrites if ($this->configExists($path) and ! $force) diff --git a/src/Eloquent/Continent.php b/src/Eloquent/Continent.php index 2a1c196..5db15e0 100644 --- a/src/Eloquent/Continent.php +++ b/src/Eloquent/Continent.php @@ -4,6 +4,13 @@ class Continent extends Model { + /** + * Indicates if the IDs are auto-incrementing. + * + * @var bool + */ + public $incrementing = false; + /** * The table associated with the model. * diff --git a/src/Eloquent/Country.php b/src/Eloquent/Country.php index b6546e5..35dec15 100644 --- a/src/Eloquent/Country.php +++ b/src/Eloquent/Country.php @@ -4,6 +4,13 @@ class Country extends Model { + /** + * Indicates if the IDs are auto-incrementing. + * + * @var bool + */ + public $incrementing = false; + /** * The table associated with the model. * @@ -30,4 +37,4 @@ public function names() return $this->hasMany('Ipalaus\Geonames\Eloquent\Name'); } -} \ No newline at end of file +} diff --git a/src/Seeders/DatabaseSeeder.php b/src/Seeders/DatabaseSeeder.php index 03295b3..5a2799a 100644 --- a/src/Seeders/DatabaseSeeder.php +++ b/src/Seeders/DatabaseSeeder.php @@ -3,7 +3,7 @@ use Ipalaus\Geonames\Importer; use Illuminate\Database\Seeder; -class DatabaseSeeder extends Seeder { +abstract class DatabaseSeeder extends Seeder { /** * The importer instance. @@ -23,4 +23,4 @@ public function __construct(Importer $importer) $this->importer = $importer; } -} \ No newline at end of file +} diff --git a/src/migrations/2013_11_28_170337_create_geonames_names.php b/src/migrations/2013_11_28_170337_create_geonames_names_table.php similarity index 100% rename from src/migrations/2013_11_28_170337_create_geonames_names.php rename to src/migrations/2013_11_28_170337_create_geonames_names_table.php diff --git a/src/migrations/2013_11_28_170817_create_geonames_alternate_names.php b/src/migrations/2013_11_28_170817_create_geonames_alternate_names_table.php similarity index 100% rename from src/migrations/2013_11_28_170817_create_geonames_alternate_names.php rename to src/migrations/2013_11_28_170817_create_geonames_alternate_names_table.php diff --git a/src/migrations/2013_11_28_171326_create_geonames_countries.php b/src/migrations/2013_11_28_171326_create_geonames_countries_table.php similarity index 100% rename from src/migrations/2013_11_28_171326_create_geonames_countries.php rename to src/migrations/2013_11_28_171326_create_geonames_countries_table.php diff --git a/src/migrations/2013_11_28_172716_create_geonames_language_codes.php b/src/migrations/2013_11_28_172716_create_geonames_language_codes_table.php similarity index 100% rename from src/migrations/2013_11_28_172716_create_geonames_language_codes.php rename to src/migrations/2013_11_28_172716_create_geonames_language_codes_table.php diff --git a/src/migrations/2013_11_28_173418_create_geonames_admin_divisions.php b/src/migrations/2013_11_28_173418_create_geonames_admin_divisions_table.php similarity index 100% rename from src/migrations/2013_11_28_173418_create_geonames_admin_divisions.php rename to src/migrations/2013_11_28_173418_create_geonames_admin_divisions_table.php diff --git a/src/migrations/2013_11_28_173425_create_geonames_admin_subdivisions.php b/src/migrations/2013_11_28_173425_create_geonames_admin_subdivisions_table.php similarity index 100% rename from src/migrations/2013_11_28_173425_create_geonames_admin_subdivisions.php rename to src/migrations/2013_11_28_173425_create_geonames_admin_subdivisions_table.php diff --git a/src/migrations/2013_11_28_173636_create_geonames_hierarchies.php b/src/migrations/2013_11_28_173636_create_geonames_hierarchies_table.php similarity index 100% rename from src/migrations/2013_11_28_173636_create_geonames_hierarchies.php rename to src/migrations/2013_11_28_173636_create_geonames_hierarchies_table.php diff --git a/src/migrations/2013_11_28_173817_create_geonames_features.php b/src/migrations/2013_11_28_173817_create_geonames_features_table.php similarity index 100% rename from src/migrations/2013_11_28_173817_create_geonames_features.php rename to src/migrations/2013_11_28_173817_create_geonames_features_table.php diff --git a/src/migrations/2013_11_28_173936_create_geonames_timezones.php b/src/migrations/2013_11_28_173936_create_geonames_timezones_table.php similarity index 100% rename from src/migrations/2013_11_28_173936_create_geonames_timezones.php rename to src/migrations/2013_11_28_173936_create_geonames_timezones_table.php diff --git a/src/migrations/2013_11_28_174249_create_geonames_continents.php b/src/migrations/2013_11_28_174249_create_geonames_continents_table.php similarity index 100% rename from src/migrations/2013_11_28_174249_create_geonames_continents.php rename to src/migrations/2013_11_28_174249_create_geonames_continents_table.php diff --git a/src/migrations/2014_05_08_230644_geonames_timezones_new_columns.php b/src/migrations/2014_05_08_230644_geonames_timezones_new_columns_table.php similarity index 100% rename from src/migrations/2014_05_08_230644_geonames_timezones_new_columns.php rename to src/migrations/2014_05_08_230644_geonames_timezones_new_columns_table.php diff --git a/src/migrations/2014_06_09_204419_geonames_admin_divisions_longer_code.php b/src/migrations/2014_06_09_204419_geonames_admin_divisions_longer_code_table.php similarity index 100% rename from src/migrations/2014_06_09_204419_geonames_admin_divisions_longer_code.php rename to src/migrations/2014_06_09_204419_geonames_admin_divisions_longer_code_table.php diff --git a/src/migrations/2014_06_10_165833_geonames_defaults_and_nullables.php b/src/migrations/2014_06_10_165833_geonames_defaults_and_nullables_table.php similarity index 100% rename from src/migrations/2014_06_10_165833_geonames_defaults_and_nullables.php rename to src/migrations/2014_06_10_165833_geonames_defaults_and_nullables_table.php diff --git a/tests/ImportCommandTest.php b/tests/ImportCommandTest.php index eba2b7d..a24b898 100644 --- a/tests/ImportCommandTest.php +++ b/tests/ImportCommandTest.php @@ -1,6 +1,7 @@ getRepo()), $this->getFiles(), array()); + + $app = new Application(); + $command->setLaravel($app); + $this->runCommand($command, array('--development' => true, '--country' => 'IP')); } @@ -21,6 +26,10 @@ public function testDevelopmentAndCountryCantBeBothOptions() public function testMustProvideAValidIsoAlpha2Country() { $command = new ImportCommandTestStub(new Importer($this->getRepo()), $this->getFiles(), array()); + + $app = new Application(); + $command->setLaravel($app); + $this->runCommand($command, array('--country' => 'Isern')); } @@ -78,6 +87,9 @@ public function testCommandCall() $command = $this->getMock('ImportCommandTestStub', $mockedMethods, array($importer, $filesystem, $config)); + $app = new Application(); + $command->setLaravel($app); + $filesystem->shouldReceive('isDirectory')->once()->andReturn(false); $filesystem->shouldReceive('makeDirectory')->once()->andReturn(true); $filesystem->shouldReceive('runProcess')->andReturn(null); @@ -114,6 +126,9 @@ public function testCommandAllFilesExistsCall() $command = $this->getMock('ImportCommandTestStub', $mockedMethods, array($importer, $filesystem, $config)); + $app = new Application(); + $command->setLaravel($app); + $filesystem->shouldReceive('isDirectory')->once()->andReturn(false); $filesystem->shouldReceive('makeDirectory')->once()->andReturn(true); $filesystem->shouldReceive('runProcess')->andReturn(null); @@ -147,6 +162,9 @@ public function testFetchOnlyOptionCall() $command = $this->getMock('ImportCommandTestStub', $mockedMethods, array($importer, $filesystem, $config)); + $app = new Application(); + $command->setLaravel($app); + $filesystem->shouldReceive('isDirectory')->once()->andReturn(false); $filesystem->shouldReceive('makeDirectory')->once()->andReturn(true); @@ -183,6 +201,9 @@ public function testDevelopmentOptionCall() $command = $this->getMock('ImportCommandTestStub', $mockedMethods, array($importer, $filesystem, $config)); + $app = new Application(); + $command->setLaravel($app); + $filesystem->shouldReceive('isDirectory')->once()->andReturn(false); $filesystem->shouldReceive('makeDirectory')->once()->andReturn(true); $filesystem->shouldReceive('runProcess')->andReturn(null); @@ -220,6 +241,9 @@ public function testCountryOptionCall() $command = $this->getMock('ImportCommandTestStub', $mockedMethods, array($importer, $filesystem, $config)); + $app = new Application(); + $command->setLaravel($app); + $filesystem->shouldReceive('isDirectory')->once()->andReturn(false); $filesystem->shouldReceive('makeDirectory')->once()->andReturn(true); $filesystem->shouldReceive('runProcess')->andReturn(null); @@ -331,7 +355,7 @@ public function call($command, array $arguments = array()) // } - public function line($string) + public function line($string, $style = null, $verbosity = null) { // } diff --git a/tests/InstallCommandTest.php b/tests/InstallCommandTest.php index 8b4f833..0e6c014 100644 --- a/tests/InstallCommandTest.php +++ b/tests/InstallCommandTest.php @@ -1,5 +1,6 @@ setLaravel($app); + $this->runCommand($command); } @@ -17,6 +21,10 @@ public function testCommandCall() public function testExistingConfigThrowsException() { $command = $this->getMock('InstallCommandTestStub', array('configExists')); + + $app = new Application(); + $command->setLaravel($app); + $command->expects($this->once()) ->method('configExists') ->will($this->returnValue(true)); @@ -27,6 +35,10 @@ public function testExistingConfigThrowsException() public function testForceEvenConfigExists() { $command = $this->getMock('InstallCommandTestStub', array('configExists')); + + $app = new Application(); + $command->setLaravel($app); + $command->expects($this->once()) ->method('configExists') ->will($this->returnValue(true)); diff --git a/tests/TruncateCommandTest.php b/tests/TruncateCommandTest.php index f5bc194..3c01d44 100644 --- a/tests/TruncateCommandTest.php +++ b/tests/TruncateCommandTest.php @@ -1,6 +1,7 @@ method('truncate'); $command = $this->getMock('TruncateCommandTestStub', array('confirmTruncate'), array($repo)); + + $app = new Application(); + $command->setLaravel($app); + $command->expects($this->once()) ->method('confirmTruncate') ->will($this->returnValue(true)); @@ -35,6 +40,10 @@ public function testExistingConfigThrowsException() $repo = $this->getMock('Ipalaus\Geonames\RepositoryInterface'); $command = $this->getMock('TruncateCommandTestStub', array('confirmTruncate'), array($repo)); + + $app = new Application(); + $command->setLaravel($app); + $command->expects($this->once()) ->method('confirmTruncate') ->will($this->returnValue(false)); @@ -58,7 +67,7 @@ protected function getMethod($name) { class TruncateCommandTestStub extends TruncateCommand { - public function line($string) + public function line($string, $style = null, $verbosity = null) { // }