tests and laravel models
This commit is contained in:
@@ -1,62 +1,20 @@
|
||||
<?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\Person;
|
||||
use XaiCorp\AbcParser\Models\Laravel5\TuneSetting;
|
||||
use XaiCorp\AbcParser\Models\Laravel5\TuneSettingAttribute;
|
||||
|
||||
class TuneSettingAttributeTest extends Test
|
||||
class TuneSettingAttributeTest 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' => 'mysql',
|
||||
'host' => 'localhost',
|
||||
'database' => 'abc-api-testing',
|
||||
'charset' => 'utf8',
|
||||
'collation' => 'utf8_unicode_ci',
|
||||
'prefix' => '',
|
||||
'strict' => false,
|
||||
'username' => 'abc-api',
|
||||
'password' => 'sio2nf0d'
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
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()
|
||||
@@ -129,7 +87,7 @@ class TuneSettingAttributeTest extends Test
|
||||
public function testTuneSettingIdValidation()
|
||||
{
|
||||
$model = factory(TuneSettingAttribute::class)->make([]);
|
||||
$model->setting_id += 1;
|
||||
$model->setting_id = Uuid::generate(4);
|
||||
|
||||
$this->assertFalse($model->validate());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user