tests and laravel models
This commit is contained in:
@@ -1,61 +1,22 @@
|
||||
<?php
|
||||
namespace Laravel5;
|
||||
namespace Tests\Laravel5;
|
||||
|
||||
use Codeception\TestCase\Test;
|
||||
use Aedart\Testing\Laravel\Traits\TestHelperTrait;
|
||||
use Webpatser\Uuid\Uuid;
|
||||
use XaiCorp\AbcParser\Models\Laravel5\Collection;
|
||||
use XaiCorp\AbcParser\Models\Laravel5\CollectionAttribute;
|
||||
use XaiCorp\AbcParser\Models\Laravel5\Person;
|
||||
use XaiCorp\AbcParser\Models\Laravel5\Tune;
|
||||
use XaiCorp\AbcParser\Models\Laravel5\TuneAttribute;
|
||||
|
||||
class CollectionAttributeTest extends Test
|
||||
class CollectionAttributeTest extends BaseDbTest
|
||||
{
|
||||
use TestHelperTrait;
|
||||
|
||||
/**
|
||||
* @var \UnitTester
|
||||
*/
|
||||
protected $tester;
|
||||
|
||||
/**
|
||||
* Define environment setup.
|
||||
*
|
||||
* @param \Illuminate\Foundation\Application $app
|
||||
* @return void
|
||||
*/
|
||||
protected function getEnvironmentSetUp($app)
|
||||
{
|
||||
// Setup default database to use sqlite :memory:
|
||||
$app['config']->set('database.default', 'testbench');
|
||||
$app['config']->set('database.connections.testbench', [
|
||||
'driver' => 'sqlite',
|
||||
'database' => ':memory:',
|
||||
'prefix' => '',
|
||||
]);
|
||||
$app->setBasePath(dirname(dirname(dirname(__DIR__))));
|
||||
$Artisan = $app->make('Artisan');
|
||||
$Artisan::call('migrate');
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected function _before()
|
||||
{
|
||||
$this->startApplication();
|
||||
$db = app()->make('db');
|
||||
$db->beginTransaction();
|
||||
|
||||
$this->withFactories(__DIR__.'/factories');
|
||||
}
|
||||
|
||||
protected function _after()
|
||||
{
|
||||
$db = app()->make('db');
|
||||
$db->rollBack();
|
||||
$this->stopApplication();
|
||||
}
|
||||
|
||||
// tests: trying to...
|
||||
|
||||
public function testMakeModel()
|
||||
@@ -128,7 +89,7 @@ class CollectionAttributeTest extends Test
|
||||
public function testTuneIdValidation()
|
||||
{
|
||||
$model = factory(CollectionAttribute::class)->make([]);
|
||||
$model->collection_id += 1;
|
||||
$model->collection_id = Uuid::generate(4);
|
||||
|
||||
$this->assertFalse($model->validate());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user