Skip to content
This repository was archived by the owner on Nov 26, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: php

php:
- 5.4
- 5.5
- 5.6

Expand All @@ -11,4 +10,4 @@ before_script:
script: phpunit -c phpunit.xml --coverage-text

after_script:
- php vendor/bin/coveralls -v
- php vendor/bin/coveralls -v
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/ImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions src/Eloquent/Continent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
9 changes: 8 additions & 1 deletion src/Eloquent/Country.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -30,4 +37,4 @@ public function names()
return $this->hasMany('Ipalaus\Geonames\Eloquent\Name');
}

}
}
4 changes: 2 additions & 2 deletions src/Seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Ipalaus\Geonames\Importer;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder {
abstract class DatabaseSeeder extends Seeder {

/**
* The importer instance.
Expand All @@ -23,4 +23,4 @@ public function __construct(Importer $importer)
$this->importer = $importer;
}

}
}
26 changes: 25 additions & 1 deletion tests/ImportCommandTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Mockery as m;
use Illuminate\Foundation\Application;
use Ipalaus\Geonames\Importer;
use Ipalaus\Geonames\Commands\ImportCommand;

Expand All @@ -12,6 +13,10 @@ class ImportCommandTest extends PHPUnit_Framework_TestCase {
public function testDevelopmentAndCountryCantBeBothOptions()
{
$command = new ImportCommandTestStub(new Importer($this->getRepo()), $this->getFiles(), array());

$app = new Application();
$command->setLaravel($app);

$this->runCommand($command, array('--development' => true, '--country' => 'IP'));
}

Expand All @@ -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'));
}

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -331,7 +355,7 @@ public function call($command, array $arguments = array())
//
}

public function line($string)
public function line($string, $style = null, $verbosity = null)
{
//
}
Expand Down
12 changes: 12 additions & 0 deletions tests/InstallCommandTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php

use Illuminate\Foundation\Application;
use Ipalaus\Geonames\Commands\InstallCommand;

class InstallCommandTest extends PHPUnit_Framework_TestCase {
Expand All @@ -8,6 +9,9 @@ public function testCommandCall()
{
$command = new InstallCommandTestStub;

$app = new Application();
$command->setLaravel($app);

$this->runCommand($command);
}

Expand All @@ -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));
Expand All @@ -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));
Expand Down
11 changes: 10 additions & 1 deletion tests/TruncateCommandTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

use Mockery as m;
use Illuminate\Foundation\Application;
use Ipalaus\Geonames\Commands\TruncateCommand;

class TruncateCommandTest extends PHPUnit_Framework_TestCase {
Expand All @@ -12,6 +13,10 @@ public function testCommandCall()
->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));
Expand All @@ -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));
Expand All @@ -58,7 +67,7 @@ protected function getMethod($name) {

class TruncateCommandTestStub extends TruncateCommand {

public function line($string)
public function line($string, $style = null, $verbosity = null)
{
//
}
Expand Down