diff --git a/example/config/mail.php b/example/config/mail.php
index a0765885..15bee1a2 100644
--- a/example/config/mail.php
+++ b/example/config/mail.php
@@ -16,7 +16,7 @@
|
*/
- 'driver' => env('MAIL_DRIVER', 'smtp'),
+ 'driver' => env('MAIL_DRIVER', 'mail'),
/*
|--------------------------------------------------------------------------
diff --git a/phpunit.xml b/phpunit.xml
index 4a564c59..95838dc0 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -30,6 +30,7 @@
+
diff --git a/tests/Integration/AdminTest.php b/tests/Integration/AdminTest.php
index 076a34f2..05359e83 100644
--- a/tests/Integration/AdminTest.php
+++ b/tests/Integration/AdminTest.php
@@ -2,8 +2,10 @@
namespace Tests\Integration;
use App\Article;
-use Tests\TestCase;
use Bkwld\Decoy\Models\Admin;
+use Carbon\Carbon;
+use Illuminate\Support\Str;
+use Tests\TestCase;
class AdminTest extends TestCase
{
@@ -67,4 +69,79 @@ public function testAdminDisableAdmins()
$this->assertResponseStatus(403);
}
+ /**
+ * Test the reset password flow
+ *
+ * @return void
+ */
+ public function testResetPasswordIndex()
+ {
+ $response = $this->get('admin/forgot');
+
+ $this->assertResponseOk();
+ }
+
+ /**
+ * Test the reset password submit button works
+ *
+ * @return void
+ */
+ public function testResetPasswordSubmit()
+ {
+ $response = $this->call('POST', 'admin/forgot', [
+ 'email' => 'test@domain.com',
+ ]);
+
+ $this->assertResponseStatus(302);
+ }
+
+ /**
+ * Test reset password form
+ *
+ * @return void
+ */
+ public function testResetPasswordFormIndex()
+ {
+ $token = Str::random(60);
+ \DB::table('password_resets')->insert([
+ 'email' => 'test@domain.com',
+ 'token' => $token,
+ 'created_at' => Carbon::now(),
+ ]);
+
+ $response = $this->get('admin/reset/'.$token);
+ $this->assertResponseOk();
+ }
+
+ /**
+ * Test that the reset password form works
+ *
+ * @return void
+ */
+ public function testResetPasswordFormSave()
+ {
+ $current_password = Admin::findOrFail(1)->password;
+
+ $token = Str::random(60);
+ \DB::table('password_resets')->insert([
+ 'email' => 'test@domain.com',
+ 'token' => $token,
+ 'created_at' => Carbon::now(),
+ ]);
+
+ $response = $this->post('admin/reset/'.$token, [
+ 'email' => 'test@domain.com',
+ 'password' => 'farting',
+ 'password_confirmation' => 'farting',
+ 'token' => $token,
+ ]);
+
+ $new_password = Admin::findOrFail(1)->password;
+
+ $this->assertResponseStatus(302);
+ $this->assertNotEquals($current_password, $new_password);
+ $this->assertEmpty(\DB::table('password_resets')
+ ->where('email', 'test@domain.com')->get());
+ }
+
}