-
-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5aae62
commit c6dd0a6
Showing
3 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ class AdminLoginTest extends TestCase | |
*/ | ||
public function testGetLogin() | ||
{ | ||
$this->assertTrue(true); | ||
|
||
$this->visit($this->baseUrl.'/admin/login') | ||
->seePageIs($this->baseUrl.'/admin/login') | ||
->see('Mage2 Admin Login'); | ||
|
@@ -23,7 +23,6 @@ public function testGetLogin() | |
*/ | ||
public function testPostLogin() | ||
{ | ||
$this->assertTrue(true); | ||
$this->visit('/admin/login') | ||
->type('[email protected]', 'email') | ||
->type('admin123', 'password') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
use Illuminate\Foundation\Testing\WithoutMiddleware; | ||
use Illuminate\Foundation\Testing\DatabaseMigrations; | ||
use Illuminate\Foundation\Testing\DatabaseTransactions; | ||
|
||
class AdminRoleTest extends TestCase { | ||
|
||
/** | ||
* A basic test example. | ||
* | ||
* @return void | ||
*/ | ||
public function testAdminRoleList() { | ||
$this->adminUserLogin(); | ||
$this->visit('/admin/role') | ||
->see('Role List') | ||
->see('Administrator') | ||
; | ||
} | ||
/** | ||
* A basic test example. | ||
* | ||
* @return void | ||
*/ | ||
public function testAdminRoleCreate() { | ||
$this->adminUserLogin(); | ||
$this->visit('/admin/role/create') | ||
->see('Create Role') | ||
->type('Editor','name') | ||
->type('editor description','description') | ||
//->check('permissions[admin.category.index]') | ||
//->check('permissions[admin.category.create,admin.category.store]') | ||
//->check('permissions[admin.category.edit,admin.category.update]') | ||
//->check('permissions[admin.category.destroy]') | ||
->press('Create Role') | ||
->seePageIs('/admin/role') | ||
->see('Editor') | ||
; | ||
} | ||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
use Mage2\Configuration\Models\Configuration; | ||
use Mage2\Install\Models\Website; | ||
use Mage2\User\Models\User; | ||
|
||
use Mage2\User\Models\Role; | ||
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase | ||
{ | ||
/** | ||
|
@@ -130,13 +130,17 @@ private function _createFrontUser() | |
|
||
private function setupAdminUserAndWebsite() | ||
{ | ||
$role = Role::create(['name' => 'Administrator', | ||
'description' => 'administrator role' | ||
]); | ||
|
||
AdminUser::create([ | ||
'first_name' => 'test User', | ||
'last_name' => 'test User', | ||
'email' => '[email protected]', | ||
'password' => bcrypt('admin123'), | ||
'is_super_admin' => 1, | ||
'role_id' => 1, // @todo change this one?? | ||
'role_id' => $role->id, // @todo change this one?? | ||
]); | ||
|
||
$host = str_replace('http://', '', $this->baseUrl); | ||
|