Skip to content

Commit

Permalink
commit-3
Browse files Browse the repository at this point in the history
  • Loading branch information
KNaveenraj-ladybird authored and faveobot committed Oct 26, 2023
1 parent 1d9fa1c commit a0b0e7b
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions tests/Unit/ExampleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

namespace Tests\Unit;

use App\User;
use Faker\Factory as FakerFactory;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Tests\TestCase;

class ExampleTest extends TestCase
Expand All @@ -19,32 +15,4 @@ public function test_example()
{
$this->assertTrue(true);
}

public function test_store_user()
{
$faker = FakerFactory::create();

//Create User -> Agent
$str = Str::random(10);
$password = Hash::make($str);
$email = $faker->unique()->email();
$user = new User([
'first_name' => $faker->firstName(),
'last_name' => $faker->lastName(),
'email' => $email,
'user_name' => $faker->unique()->userName(),
'password' => $password,
'active' => 1,
'role' => 'user',
]);
$user->save();

// Check if data is inserted
$this->assertDatabaseHas('users', ['email' => $email]);

// Authenticate as the created user
$this->actingAs($user);

$this->assertAuthenticated();
}
}

0 comments on commit a0b0e7b

Please sign in to comment.