Skip to content

Commit

Permalink
Fixing the Models (table names)
Browse files Browse the repository at this point in the history
+ Adding a test class for PasswordReset Model
  • Loading branch information
arcanedev-maroc committed Feb 20, 2017
1 parent 785423c commit b4c868f
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Models/PasswordReset.php
Expand Up @@ -50,10 +50,10 @@ class PasswordReset extends AbstractModel
*/
public function __construct(array $attributes = [])
{
parent::__construct($attributes);

$this->setConnection(null)->setPrefix(null);
$this->setTable(config('auth.passwords.users.table', 'password_resets'));

parent::__construct($attributes);
}

/* -----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Permission.php
Expand Up @@ -61,9 +61,9 @@ class Permission extends AbstractModel implements PermissionContract
*/
public function __construct(array $attributes = [])
{
$this->setTable(config('laravel-auth.permissions.table', 'permissions'));

parent::__construct($attributes);

$this->setTable(config('laravel-auth.permissions.table', 'permissions'));
}

/* -----------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/Models/Role.php
Expand Up @@ -66,9 +66,9 @@ class Role extends AbstractModel implements RoleContract
*/
public function __construct(array $attributes = [])
{
$this->setTable(config('laravel-auth.roles.table', 'roles'));

parent::__construct($attributes);

$this->setTable(config('laravel-auth.roles.table', 'roles'));
}

/* ------------------------------------------------------------------------------------------------
Expand Down
55 changes: 55 additions & 0 deletions tests/Models/PasswordResetTest.php
@@ -0,0 +1,55 @@
<?php namespace Arcanedev\LaravelAuth\Tests\Models;
use Arcanedev\LaravelAuth\Models\PasswordReset;

/**
* Class PasswordResetTest
*
* @package Arcanedev\LaravelAuth\Tests\Models
* @author ARCANEDEV <arcanedev.maroc@gmail.com>
*/
class PasswordResetTest extends ModelsTest
{
/* ------------------------------------------------------------------------------------------------
| Properties
| ------------------------------------------------------------------------------------------------
*/
/** @var \Arcanedev\LaravelAuth\Models\PasswordReset */
protected $passwordReset;

/* ------------------------------------------------------------------------------------------------
| Main Functions
| ------------------------------------------------------------------------------------------------
*/
public function setUp()
{
parent::setUp();

$this->passwordReset = new PasswordReset;
}

public function tearDown()
{
unset($this->passwordReset);

parent::tearDown();
}

/* ------------------------------------------------------------------------------------------------
| Test Functions
| ------------------------------------------------------------------------------------------------
*/

/** @test */
public function it_can_be_instantiated()
{
$expectations = [
\Illuminate\Database\Eloquent\Model::class,
\Arcanedev\LaravelAuth\Models\PasswordReset::class,
];

foreach ($expectations as $expected) {
$this->instance($expected, $this->passwordReset);
}
}

}

0 comments on commit b4c868f

Please sign in to comment.