Commit 279e1b40 authored by abkrim's avatar abkrim 😀
Browse files

Try to testing DB. Failed

parent 3e52efea
C:37:"PHPUnit\Runner\DefaultTestResultCache":260:{a:2:{s:7:"defects";a:1:{s:62:"Abkrim\DbSchema\Tests\DbSchemaTest::it_can_access_the_database";i:4;}s:5:"times";a:2:{s:48:"Abkrim\DbSchema\Tests\DbSchemaTest::true_is_true";d:0.003;s:62:"Abkrim\DbSchema\Tests\DbSchemaTest::it_can_access_the_database";d:0.015;}}}
\ No newline at end of file
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->boolean('is_super_admin')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
......@@ -22,8 +22,11 @@
<logging>
<log type="tap" target="build/report.tap"/>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/>
<log type="coverage-html" target="build/coverage" />
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
<php>
<env name="DB_CONNECTION" value="testing" />
</php>
</phpunit>
......@@ -16,6 +16,6 @@ class DbSchemaFacade extends Facade
*/
protected static function getFacadeAccessor()
{
return 'db-dbSchema';
return 'db-schema';
}
}
......@@ -28,7 +28,7 @@ class DbSchemaServiceProvider extends ServiceProvider
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/../config/config.php' => config_path('db-dbSchema.php'),
__DIR__.'/../config/config.php' => config_path('db-schema.php'),
], 'config');
// Publishing the views.
......@@ -65,10 +65,10 @@ class DbSchemaServiceProvider extends ServiceProvider
public function register()
{
// Automatically apply the package configuration
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'db-dbSchema');
$this->mergeConfigFrom(__DIR__.'/../config/config.php', 'db-schema');
// Register the main class to use with the facade
$this->app->singleton('db-dbSchema', function () {
$this->app->singleton('db-schema', function () {
return new DbSchema;
});
}
......
<?php
namespace Abkrim\DbSchema\Tests;
use Illuminate\Support\Facades\DB;
use PHPUnit\Framework\TestCase;
use Faker\Factory as Faker;
class DbSchemaTest extends TestCase
{
/** @test */
public function it_can_access_the_database()
{
$faker = Faker::create();
//d($faker->unique()->email);
$user = DB::table('users')->insert([
'email' => $faker->unique()->email,
'name' => $faker->unique()->name(),
// $table->bigIncrements('id');
// $table->string('name');
// $table->string('email')->unique();
// $table->timestamp('email_verified_at')->nullable();
// $table->string('password');
// $table->rememberToken();
// $table->boolean('is_super_admin')->default(false);
// $table->timestamps();
]);
}
}
<?php
namespace Abkrim\DbSchema\Tests;
use PHPUnit\Framework\TestCase;
class ExampleTest extends TestCase
{
/** @test */
public function true_is_true()
{
$this->assertTrue(true);
}
}
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