Commit 505d8769 authored by abkrim's avatar abkrim 😀
Browse files

First test passed

parent 183972f2
......@@ -19,7 +19,7 @@ class CreateUsersTable extends Migration
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->string('remember_token')->nullable();
$table->boolean('is_super_admin')->default(false);
$table->timestamps();
});
......
......@@ -2,23 +2,51 @@
namespace Abkrim\DbSchema\Tests;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
use PHPUnit\Framework\TestCase;
use Abkrim\DbSchema\DbSchema;
use Abkrim\DbSchema\DbSchemaServiceProvider;
use Abkrim\DbSchema\DbSchemaFacade;
use Faker\Factory as Faker;
use Illuminate\Support\Facades\DB;
use Orchestra\Testbench\TestCase;
class DbSchemaTest extends TestCase
{
protected function getPackageProviders($app)
{
return [
DbSchemaServiceProvider::class
];
}
protected function getPackageAliases($app)
{
return [
'DbSchema' => DbSchema::class
];
}
protected function getEnvironmentSetUp($app)
{
include_once __DIR__ . '/../database/migrations/create_users_table.php.stub';
(new \CreateUsersTable)->up();
}
/** @test */
public function it_can_access_the_database()
function it_can_access_the_database()
{
$faker = Faker::create();
$mail = 'fake@mail.tld';
$user = DB::table('users')->insert([
'email' => $faker->unique()->email,
DB::table('users')->insert([
'email' => $mail,
'name' => $faker->unique()->name,
'password' => $faker->password(10),
'rememberToken' => $faker->md5
]);
'remember_token' => $faker->md5
]);
$user = DB::table('users')->first();
$this->assertSame($user->email, $mail);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment