Browse Source

Pass all test suite with migrate and seed

pull/1/head
Nafies Luthfi 9 years ago
parent
commit
1fd7a7169d
  1. 10
      database/factories/ModelFactory.php
  2. 2
      database/migrations/2016_07_08_182606_create_subscriptions_table.php
  3. 2
      routes/web.php
  4. 1
      tests/TestCase.php
  5. 2
      tests/api/ApiEventsTest.php
  6. 2
      tests/api/ApiManageProjectsTest.php
  7. 2
      tests/auth/ManageUsersTest.php
  8. 2
      tests/auth/MemberChangePasswordTest.php
  9. 6
      tests/auth/MemberRegistrationAndLoginTest.php
  10. 2
      tests/auth/MemberResetPasswordTest.php
  11. 2
      tests/functional/ManageFeaturesTest.php
  12. 2
      tests/functional/ManagePaymentsTest.php
  13. 10
      tests/functional/ManageProjectsTest.php
  14. 6
      tests/functional/ManageSubscriptionsTest.php
  15. 2
      tests/functional/ManageTasksTest.php

10
database/factories/ModelFactory.php

@ -13,21 +13,13 @@ $factory->define(User::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
'username' => $faker->unique()->username,
'email' => $email = $faker->unique()->email,
'email' => $faker->unique()->email,
'password' => 'member',
'remember_token' => str_random(10),
'api_token' => str_random(40),
];
});
$factory->define(Role::class, function (Faker\Generator $faker) {
return [
'type' => 0,
'name' => $faker->word,
'label' => $faker->sentence,
];
});
$factory->define(Project::class, function (Faker\Generator $faker) {
$proposalDate = $faker->dateTimeBetween('-1 year', '-1 month')->format('Y-m-d');

2
database/migrations/2016_07_08_182606_create_subscriptions_table.php

@ -22,7 +22,7 @@ class CreateSubscriptionsTable extends Migration {
$table->string('epp_code', 60)->nullable();
$table->integer('domain_price')->unsigned();
$table->string('hosting_capacity', 60)->nullable();
$table->boolean('status_id')->default(1);
$table->boolean('status_id')->unsigned()->default(1);
$table->integer('hosting_price')->unsigned()->nullable();
$table->date('start_date')->nullable();
$table->date('due_date')->nullable();

2
routes/web.php

@ -1,5 +1,5 @@
<?php
auth()->loginUsingId(1);
// auth()->loginUsingId(1);
require __DIR__ . '/web/helpers.php';
require __DIR__ . '/web/pages.php';

1
tests/TestCase.php

@ -29,7 +29,6 @@ class TestCase extends Illuminate\Foundation\Testing\TestCase
protected function adminUserSigningIn()
{
factory(Role::class)->create(['name' => 'admin']);
$user = factory(User::class)->create();
$user->assignRole('admin');
$this->actingAs($user);

2
tests/api/ApiEventsTest.php

@ -8,7 +8,7 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
class ApiEventsTest extends TestCase
{
use DatabaseTransactions;
use DatabaseMigrations;
/** @test */
public function it_can_get_all_existing_events()

2
tests/api/ApiManageProjectsTest.php

@ -8,7 +8,7 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
class ApiManageProjectsTest extends TestCase
{
use DatabaseTransactions;
use DatabaseMigrations;
/** @test */
public function user_can_get_project_lists()

2
tests/auth/ManageUsersTest.php

@ -7,7 +7,7 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
class ManageUsersTest extends TestCase
{
use DatabaseTransactions;
use DatabaseMigrations;
/** @test */
public function admin_can_insert_new_user()

2
tests/auth/MemberChangePasswordTest.php

@ -7,7 +7,7 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
class MemberChangePasswordTest extends TestCase
{
use DatabaseTransactions;
use DatabaseMigrations;
/** @test */
public function member_can_change_password()

6
tests/auth/MemberRegistrationAndLoginTest.php

@ -7,13 +7,13 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
class MemberRegistrationAndLoginTest extends TestCase
{
use DatabaseTransactions;
use DatabaseMigrations;
/** @test */
public function registration_validation()
{
$user = factory(User::class)->create(['email' => 'member@app.dev']);
$user->assignRole('customer');
// $user = factory(User::class)->create(['email' => 'member@app.dev']);
// $user->assignRole('customer');
$this->visit(route('auth.register'));
$this->type('', 'name');

2
tests/auth/MemberResetPasswordTest.php

@ -6,7 +6,7 @@ use Illuminate\Foundation\Testing\DatabaseTransactions;
class MemberResetPasswordTest extends TestCase
{
use DatabaseTransactions;
use DatabaseMigrations;
/** @test */
public function member_can_reset_password_by_their_email()

2
tests/functional/ManageFeaturesTest.php

@ -10,7 +10,7 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
class ManageFeaturesTest extends TestCase
{
use DatabaseTransactions;
use DatabaseMigrations;
/** @test */
public function admin_can_entry_feature()

2
tests/functional/ManagePaymentsTest.php

@ -9,7 +9,7 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
class ManagePaymentsTest extends TestCase
{
use DatabaseTransactions;
use DatabaseMigrations;
/** @test */
public function admin_can_entry_project_a_cashin_payment()

10
tests/functional/ManageProjectsTest.php

@ -17,9 +17,6 @@ class ManageProjectsTest extends TestCase
/** @test */
public function admin_can_input_new_project_with_existing_customer()
{
$adminRole = factory(Role::class)->create(['name' => 'admin']);
$customerRole = factory(Role::class)->create(['name' => 'customer']);
$users = factory(User::class, 2)->create();
$users[0]->assignRole('admin');
$this->actingAs($users[0]);
@ -46,7 +43,6 @@ class ManageProjectsTest extends TestCase
public function admin_can_input_new_project_with_new_customer()
{
$this->adminUserSigningIn();
$customerRole = factory(Role::class)->create(['name' => 'customer']);
$this->visit(route('projects.index'));
$this->seePageIs(route('projects.index'));
@ -112,9 +108,6 @@ class ManageProjectsTest extends TestCase
/** @test */
public function admin_can_edit_a_project()
{
$adminRole = factory(Role::class)->create(['name' => 'admin']);
$customerRole = factory(Role::class)->create(['name' => 'customer']);
$users = factory(User::class, 2)->create();
$users[0]->assignRole('admin');
$this->actingAs($users[0]);
@ -150,9 +143,6 @@ class ManageProjectsTest extends TestCase
/** @test */
public function form_is_validated_on_invalid_project_entry()
{
$adminRole = factory(Role::class)->create(['name' => 'admin']);
$customerRole = factory(Role::class)->create(['name' => 'customer']);
$users = factory(User::class, 2)->create();
$users[0]->assignRole('admin');
$this->actingAs($users[0]);

6
tests/functional/ManageSubscriptionsTest.php

@ -9,7 +9,7 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
class ManageSubscriptionsTest extends TestCase
{
use DatabaseTransactions;
use DatabaseMigrations;
/** @test */
public function admin_can_entry_subscription()
@ -88,7 +88,7 @@ class ManageSubscriptionsTest extends TestCase
$this->select($project->id, 'project_id');
$this->select($customer->id, 'customer_id');
$this->select($vendor->id, 'vendor_id');
$this->select(0,'status_id');
$this->select(1,'status_id');
$this->press(trans('subscription.update'));
$this->seePageIs('subscriptions/' . $subscription->id . '/edit');
@ -97,7 +97,7 @@ class ManageSubscriptionsTest extends TestCase
'epp_code' => $eppCode,
'customer_id' => $customer->id,
'project_id' => $project->id,
'status_id' => 0,
'status_id' => 1,
'hosting_capacity' => '4GB',
'hosting_price' => '500000',
'start_date' => '2015-05-02',

2
tests/functional/ManageTasksTest.php

@ -10,7 +10,7 @@ use Illuminate\Foundation\Testing\WithoutMiddleware;
class ManageTasksTest extends TestCase
{
use DatabaseTransactions;
use DatabaseMigrations;
/** @test */
public function admin_can_entry_task()

Loading…
Cancel
Save