Fixes for emails; send user registered/pending depending on state
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Pages;
|
||||
|
||||
use Laravel\Dusk\Browser;
|
||||
|
||||
class HomePage extends Page
|
||||
{
|
||||
/**
|
||||
* Get the URL for the page.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function url()
|
||||
{
|
||||
return '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the browser is on the page.
|
||||
*
|
||||
* @param Browser $browser
|
||||
* @return void
|
||||
*/
|
||||
public function assert(Browser $browser)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the element shortcuts for the page.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function elements()
|
||||
{
|
||||
return [
|
||||
'@element' => '#selector',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser\Pages;
|
||||
|
||||
use Laravel\Dusk\Page as BasePage;
|
||||
|
||||
abstract class Page extends BasePage
|
||||
{
|
||||
/**
|
||||
* Get the global element shortcuts for the site.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function siteElements()
|
||||
{
|
||||
return [
|
||||
'@element' => '#selector',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Tests\DuskTestCase;
|
||||
use Laravel\Dusk\Browser;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
|
||||
class RegistrationTest extends DuskTestCase
|
||||
{
|
||||
/**
|
||||
* Test the registration
|
||||
*/
|
||||
public function testBasicExample()
|
||||
{
|
||||
/*$this->browse(function (Browser $browser) {
|
||||
$browser->visit('/register')
|
||||
->assertSee('Register');
|
||||
});*/
|
||||
}
|
||||
}
|
||||
2
tests/Browser/console/.gitignore
vendored
2
tests/Browser/console/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
2
tests/Browser/screenshots/.gitignore
vendored
2
tests/Browser/screenshots/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests;
|
||||
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Contracts\Console\Kernel;
|
||||
|
||||
trait CreatesApplication
|
||||
{
|
||||
/**
|
||||
* Creates the application.
|
||||
*
|
||||
* @return \Illuminate\Foundation\Application
|
||||
*/
|
||||
public function createApplication()
|
||||
{
|
||||
$app = require __DIR__ . '/../bootstrap/app.php';
|
||||
$app->make(Kernel::class)->bootstrap();
|
||||
//Hash::driver('bcrypt')->setRounds(4);
|
||||
return $app;
|
||||
}
|
||||
}
|
||||
38
tests/RegistrationTest.php
Normal file
38
tests/RegistrationTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
use \App\Models\Enums\PilotState;
|
||||
|
||||
class RegistrationTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testRegistration()
|
||||
{
|
||||
Event::fake();
|
||||
Mail::fake();
|
||||
|
||||
$userSvc = app('App\Services\UserService');
|
||||
|
||||
setting('pilot.auto_accept', true);
|
||||
|
||||
$user = factory(App\Models\User::class)->create();
|
||||
$user = $userSvc->createPilot($user);
|
||||
|
||||
$this->assertEquals(PilotState::ACTIVE, $user->state);
|
||||
|
||||
Event::assertDispatched(\App\Events\UserRegistered::class, function ($e) use ($user) {
|
||||
return $e->user->id === $user->id
|
||||
&& $e->user->state === $user->state;
|
||||
});
|
||||
|
||||
/*Mail::assertSent(\App\Mail\UserRegistered::class, function ($mail) use ($user) {
|
||||
return $mail->user->id === $user->id
|
||||
&& $mail->user->state === $user->state;
|
||||
});*/
|
||||
}
|
||||
}
|
||||
@@ -39,8 +39,6 @@ abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
$this->reset_db();
|
||||
|
||||
Mail::fake();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user