Skip to content

Instantly share code, notes, and snippets.

@Tjoosten
Last active July 17, 2017 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tjoosten/2a56c6e5eac7090b46a43553eb7f5617 to your computer and use it in GitHub Desktop.
Save Tjoosten/2a56c6e5eac7090b46a43553eb7f5617 to your computer and use it in GitHub Desktop.
PS C:\Users\Gebruiker\Desktop\databaser-layer> vendor\\bin\\phpunit
PHPUnit 6.2.3 by Sebastian Bergmann and contributors.
E 1 / 1 (100%)
Time: 53 ms, Memory: 4.00MB
There was 1 error:
1) ActivismeBE\DatabaseLayering\Tests\Repositories\RepositoryTest::testRepository
Error: Call to a member function call() on null
C:\Users\Gebruiker\Desktop\databaser-layer\vendor\laravel\framework\src\Illuminate\Foundation\Testing\Concerns\InteractsWithConsole.php:18
C:\Users\Gebruiker\Desktop\databaser-layer\vendor\orchestra\testbench-core\src\Traits\WithLaravelMigrations.php:22
C:\Users\Gebruiker\Desktop\databaser-layer\tests\RepositoryTest.php:54
C:\Users\Gebruiker\Desktop\databaser-layer\tests\RepositoryTest.php:16
ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
PS C:\Users\Gebruiker\Desktop\databaser-layer>
<?php
namespace ActivismeBE\DatabaseLayering\Tests\Repositories;
use \Mockery as m;
use Illuminate\Database\Schema\Blueprint;
use \Orchestra\Testbench\TestCase as Orchestra;
class RepositoryTest extends Orchestra
{
protected $mock;
protected $repository;
public function setUp()
{
$this->setUpDatabase($this->app);
parent::setUp();
$this->mock = m::mock('Illuminate\Database\Eloquent\Model');
}
protected function getPackageProviders($app)
{
return [
\ActivismeBE\DatabaseLayering\Providers\RepositoryProvider::class,
\Orchestra\Database\ConsoleServiceProvider::class,
];
}
protected function getEnvironmentSetup($app)
{
// Setup default database to use sqlite :memory:
$app['config']->set('database.default', 'sqlite');
$app['config']->set('database.connections.sqlite', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
]);
}
/**
* Resolve application HTTP Kernel implementation.
*
* @param \Illuminate\Foundation\Application $app
* @return void
*/
protected function resolveApplicationHttpKernel($app)
{
$app->singleton('Illuminate\Contracts\Http\Kernel', 'Acme\Testbench\Http\Kernel');
}
protected function setUpDatabase($app)
{
$this->loadLaravelMigrations(['--database' => 'default', '--realpath' => realpath(__DIR__ . '/migrations')]);
}
public function testRepository()
{
$this->assertTrue(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment