Skip to content

Commit

Permalink
Merge pull request #28 from ARCANEDEV/patch-1
Browse files Browse the repository at this point in the history
Updating the package
  • Loading branch information
arcanedev-maroc authored Feb 18, 2018
2 parents fe444d8 + 16037ba commit d782975
Show file tree
Hide file tree
Showing 17 changed files with 764 additions and 759 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 2
runs: 3
php_code_sniffer:
enabled: true
config:
Expand Down
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ php:

matrix:
allow_failures:
- php: 7.2
- php: nightly

before_script:
Expand All @@ -23,5 +22,5 @@ script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
- if [ "$TRAVIS_PHP_VERSION" != "7.2" ] && [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" != "7.2" ] && [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2017 | ARCANEDEV <arcanedev.maroc@gmail.com> - LaravelAuth
Copyright (c) 2015-2018 | ARCANEDEV <arcanedev.maroc@gmail.com> - LaravelAuth

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"license": "MIT",
"require": {
"php": ">=7.0",
"arcanedev/support": "~4.0",
"arcanedev/support": "~4.2.0",
"arcanesoft/contracts": "~2.0.0"
},
"require-dev": {
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
</filter>
<php>
<env name="APP_ENV" value="testing"/>
<env name="DB_CONNECTION" value="testing"/>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="SESSION_DRIVER" value="array"/>
</php>
Expand Down
2 changes: 2 additions & 0 deletions src/Models/PasswordReset.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* @property string email
* @property string token
* @property \Carbon\Carbon created_at
*
* @property \Arcanedev\LaravelAuth\Models\User $user
*/
class PasswordReset extends AbstractModel
{
Expand Down
4 changes: 2 additions & 2 deletions tests/LaravelAuthServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->provider);
static::assertInstanceOf($expected, $this->provider);
}
}

Expand All @@ -64,6 +64,6 @@ public function it_can_provides()
//
];

$this->assertEquals($expected, $this->provider->provides());
static::assertEquals($expected, $this->provider->provides());
}
}
8 changes: 4 additions & 4 deletions tests/MigrationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public function it_can_publish_migrations()
$src = $this->getMigrationsSrcPath();
$dest = $this->getMigrationsDestPath();

$this->assertCount(0, $filesystem->allFiles($dest));
static::assertCount(0, $filesystem->allFiles($dest));

$this->publishMigrations();

$this->assertEquals(
static::assertEquals(
count($filesystem->allFiles($src)),
count($filesystem->allFiles($dest))
);
Expand All @@ -43,7 +43,7 @@ public function it_can_migrate()
$prefix = config('laravel-auth.database.prefix');

foreach ($this->getTablesNames() as $table) {
$this->assertTrue(
static::assertTrue(
Schema::hasTable($prefix.$table),
"The table [{$prefix}{$table}] not found in the database."
);
Expand All @@ -52,7 +52,7 @@ public function it_can_migrate()
/** password_resets table */
$table = config('auth.passwords.users.table');

$this->assertTrue(
static::assertTrue(
Schema::hasTable($table),
"The table [{$table}] not found in the database."
);
Expand Down
47 changes: 46 additions & 1 deletion tests/Models/ModelsTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<?php namespace Arcanedev\LaravelAuth\Tests\Models;

use Arcanedev\LaravelAuth\Models\Permission;
use Arcanedev\LaravelAuth\Models\Role;
use Arcanedev\LaravelAuth\Models\User;
use Arcanedev\LaravelAuth\Tests\TestCase;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Event;

/**
Expand Down Expand Up @@ -35,6 +39,47 @@ public function tearDown()
parent::tearDown();
}

/* -----------------------------------------------------------------
| Database Methods
| -----------------------------------------------------------------
*/

/**
* Create a user model.
*
* @param array $attributes
*
* @return \Arcanedev\LaravelAuth\Models\User|\Arcanesoft\Contracts\Auth\Models\User|mixed
*/
protected static function createNewUser(array $attributes)
{
return User::query()->create($attributes);
}

/**
* Create a role model.
*
* @param array $attributes
*
* @return \Arcanedev\LaravelAuth\Models\Role|\Arcanesoft\Contracts\Auth\Models\Role|mixed
*/
protected static function createNewRole(array $attributes)
{
return Role::query()->create($attributes);
}

/**
* Create a permission model.
*
* @param array $attributes
*
* @return \Arcanedev\LaravelAuth\Models\Permission|\Arcanesoft\Contracts\Auth\Models\Permission|mixed
*/
protected static function createNewPermission(array $attributes)
{
return Permission::query()->create($attributes);
}

/* -----------------------------------------------------------------
| Custom assertions
| -----------------------------------------------------------------
Expand All @@ -47,7 +92,7 @@ public function tearDown()
*/
protected function assertFiredEvents(array $keys)
{
foreach (collect($this->modelEvents)->only($keys)->values()->toArray() as $event) {
foreach (Collection::make($this->modelEvents)->only($keys)->values()->toArray() as $event) {
Event::assertDispatched($event);
}
}
Expand Down
24 changes: 10 additions & 14 deletions tests/Models/PasswordResetTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php namespace Arcanedev\LaravelAuth\Tests\Models;

use Arcanedev\LaravelAuth\Models\PasswordReset;
use Arcanedev\LaravelAuth\Models\User;

/**
* Class PasswordResetTest
Expand Down Expand Up @@ -52,7 +51,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->passwordReset);
static::assertInstanceOf($expected, $this->passwordReset);
}
}

Expand All @@ -62,7 +61,7 @@ public function it_can_get_user_and_check_if_token_was_expired()
PasswordReset::getTokenRepository()->create($user = $this->createUser());

/** @var \Arcanedev\LaravelAuth\Models\PasswordReset $pr */
$pr = $this->passwordReset->where('email', $user->email)->first();
$pr = $this->passwordReset->newQuery()->where('email', $user->email)->first();

$this->assertEquals($user->toArray(), $pr->user->toArray());
$this->assertFalse($pr->isExpired());
Expand All @@ -84,16 +83,13 @@ public function it_can_get_user_and_check_if_token_was_expired()
*/
protected function createUser()
{
$user = User::query()->create([
'username' => 'john.doe',
'first_name' => 'John',
'last_name' => 'DOE',
'email' => 'j.doe@gmail.com',
'password' => 'PaSsWoRd',
]);

$user->refresh();

return $user;
return static::createNewUser([
'username' => 'john.doe',
'first_name' => 'John',
'last_name' => 'DOE',
'email' => 'j.doe@gmail.com',
'password' => 'PaSsWoRd',
])
->refresh();
}
}
Loading

0 comments on commit d782975

Please sign in to comment.