Skip to content

Commit

Permalink
Release 4.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette authored Jun 3, 2020
2 parents 427106c + 3f87fe8 commit 90f3790
Show file tree
Hide file tree
Showing 22 changed files with 114 additions and 75 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [v4.4.3]

### Fixed
- Changed some private methods to protected in tests for easier extension.
- Tentative fix for duplication of user_name in user Factories.
- Factories now uses `::class` reference instead of string.
- Fix `ExceptionHandlerTest` test to speed things up.

## [v4.4.2]

### Fixed
Expand Down Expand Up @@ -973,3 +981,4 @@ See [http://learn.userfrosting.com/upgrading/40-to-41](Upgrading 4.0.x to 4.1.x
[v4.4.0]: https://github.com/userfrosting/UserFrosting/compare/v4.3.3...v4.4.0
[v4.4.1]: https://github.com/userfrosting/UserFrosting/compare/v4.4.0...v4.4.1
[v4.4.2]: https://github.com/userfrosting/UserFrosting/compare/v4.4.1...v4.4.2
[v4.4.3]: https://github.com/userfrosting/UserFrosting/compare/v4.4.2...v4.4.3
2 changes: 1 addition & 1 deletion app/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace UserFrosting;

// Some standard defines
define('UserFrosting\VERSION', '4.4.1');
define('UserFrosting\VERSION', '4.4.3');
define('UserFrosting\DS', '/');
define('UserFrosting\PHP_MIN_VERSION', '7.1');
define('UserFrosting\PHP_RECOMMENDED_VERSION', '7.3');
Expand Down
3 changes: 2 additions & 1 deletion app/sprinkles/account/factories/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
*/

use League\FactoryMuffin\Faker\Facade as Faker;
use UserFrosting\Sprinkle\Account\Database\Models\Group;

/*
* General factory for the Group Model
*/
$fm->define('UserFrosting\Sprinkle\Account\Database\Models\Group')->setDefinitions([
$fm->define(Group::class)->setDefinitions([
'name' => Faker::word(),
'description' => Faker::paragraph(),
'slug' => function ($object, $saved) {
Expand Down
3 changes: 2 additions & 1 deletion app/sprinkles/account/factories/Permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
*/

use League\FactoryMuffin\Faker\Facade as Faker;
use UserFrosting\Sprinkle\Account\Database\Models\Permission;

/*
* General factory for the Permission Model
*/
$fm->define('UserFrosting\Sprinkle\Account\Database\Models\Permission')->setDefinitions([
$fm->define(Permission::class)->setDefinitions([
'name' => Faker::word(),
'description' => Faker::paragraph(),
'conditions' => Faker::word(),
Expand Down
3 changes: 2 additions & 1 deletion app/sprinkles/account/factories/Roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
*/

use League\FactoryMuffin\Faker\Facade as Faker;
use UserFrosting\Sprinkle\Account\Database\Models\Role;

/*
* General factory for the Role Model
*/
$fm->define('UserFrosting\Sprinkle\Account\Database\Models\Role')->setDefinitions([
$fm->define(Role::class)->setDefinitions([
'name' => Faker::word(),
'description' => Faker::paragraph(),
'slug' => function ($object, $saved) {
Expand Down
7 changes: 5 additions & 2 deletions app/sprinkles/account/factories/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
*/

use League\FactoryMuffin\Faker\Facade as Faker;
use UserFrosting\Sprinkle\Account\Database\Models\User;

/*
* General factory for the User Model
*/
$fm->define('UserFrosting\Sprinkle\Account\Database\Models\User')->setDefinitions([
'user_name' => Faker::username(),
$fm->define(User::class)->setDefinitions([
'first_name' => Faker::firstNameMale(),
'last_name' => Faker::firstNameMale(),
'user_name' => function ($object, $saved) {
return $object->first_name . '_' . $object->last_name;
},
'email' => Faker::unique()->email(),
'locale' => 'en_US',
'flag_verified' => 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1753,7 +1753,7 @@ public function testVerifyWithFailedValidation()
/**
* @return AccountController
*/
private function getController()
protected function getController()
{
return new AccountController($this->ci);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function testUserHardDeleteWithUserRelations()
$this->assertSame(1, Persistence::where('user_id', $user->id)->count());

//$user->roles - role_users
$role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role');
$role = $fm->create(Role::class);
$user->roles()->attach($role->id);
$this->assertSame(1, $user->roles()->count());

Expand Down
3 changes: 2 additions & 1 deletion app/sprinkles/account/tests/Integration/FactoriesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use UserFrosting\Tests\TestCase;
use UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface;
use UserFrosting\Sprinkle\Account\Database\Models\User;
use UserFrosting\Sprinkle\Core\Tests\TestDatabase;
use UserFrosting\Sprinkle\Core\Tests\RefreshDatabase;

Expand All @@ -35,7 +36,7 @@ public function testUserFactory()

$fm = $this->ci->factory;

$user = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\User');
$user = $fm->create(User::class);
$this->assertInstanceOf(UserInterface::class, $user);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function testPageListWithNoPermission()
/**
* @return ActivityController
*/
private function getController()
protected function getController()
{
return new ActivityController($this->ci);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function testGetModalConfirmClearCacheWithNoPermission()
/**
* @return AdminController
*/
private function getController()
protected function getController()
{
return new AdminController($this->ci);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace UserFrosting\Sprinkle\Admin\Tests\Integration\Controller;

use UserFrosting\Sprinkle\Account\Database\Models\Group;
use UserFrosting\Sprinkle\Account\Tests\withTestUser;
use UserFrosting\Sprinkle\Admin\Controller\GroupController;
use UserFrosting\Sprinkle\Core\Tests\RefreshDatabase;
Expand Down Expand Up @@ -133,7 +134,7 @@ public function testGetUsersWithNoPermission(GroupController $controller)

// Create test group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group = $fm->create(Group::class);

// Get controller
$controller = $this->getController();
Expand All @@ -156,7 +157,7 @@ public function testpageInfoWithNoPermission(GroupController $controller)

// Create test group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group = $fm->create(Group::class);

// Get controller
$controller = $this->getController();
Expand All @@ -179,7 +180,7 @@ public function testpageInfoWithPartialPermissions(GroupController $controller)

// Create test group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group = $fm->create(Group::class);

// Give user partial permissions
$this->giveUserTestPermission($testUser, 'uri_group'); // Can view, but can't edit or delete
Expand Down Expand Up @@ -245,7 +246,7 @@ public function testDeleteWithNoPermission(GroupController $controller)

// Create test group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group = $fm->create(Group::class);

// Get controller
$controller = $this->getController();
Expand All @@ -268,7 +269,7 @@ public function testGetModalConfirmDeleteWithNoPermission(GroupController $contr

// Create test group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group = $fm->create(Group::class);

// Get controller
$controller = $this->getController();
Expand Down Expand Up @@ -314,7 +315,7 @@ public function testGetModalEditWithNoPermission(GroupController $controller)

// Create test group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group = $fm->create(Group::class);

// Get controller
$controller = $this->getController();
Expand All @@ -341,7 +342,7 @@ public function testUpdateInfoWithNoPermission(GroupController $controller)

// Create a group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group = $fm->create(Group::class);

// Get controller
$controller = $this->getController();
Expand Down Expand Up @@ -383,19 +384,19 @@ public function testUpdateInfoWithNoGroup(GroupController $controller)
/**
* @return GroupController
*/
private function getController()
protected function getController()
{
return new GroupController($this->ci);
}

private function setupUser()
protected function setupUser()
{
// Guest user, won't have any access
$testUser = $this->createTestUser(false, true);

// Create test role
$fm = $this->ci->factory;
$fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group', [
$fm->create(Group::class, [
'slug' => 'foo',
'name' => 'bar',
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ public function testDelete(GroupController $controller)
{
// Create test group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group = $fm->create(Group::class);

// Get controller stuff
$result = $controller->delete($this->getRequest(), $this->getResponse(), ['slug' => $group->slug]);
Expand Down Expand Up @@ -377,7 +377,7 @@ public function testDeleteWithUserInGroup(GroupController $controller)

// Create test group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group = $fm->create(Group::class);

// Associate user to group
$testUser->group()->associate($group);
Expand Down Expand Up @@ -441,7 +441,7 @@ public function testGetModalConfirmDeleteWithUserInGroup(GroupController $contro

// Create test group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group = $fm->create(Group::class);

// Associate user to group
$testUser->group()->associate($group);
Expand Down Expand Up @@ -516,7 +516,7 @@ public function testUpdateInfo(GroupController $controller)
{
// Create a group
$fm = $this->ci->factory;
$group = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group', [
$group = $fm->create(Group::class, [
'name' => 'barbar',
'slug' => 'foofoo',
]);
Expand Down Expand Up @@ -621,7 +621,7 @@ public function testUpdateInfoWithDuplicateSlug(GroupController $controller)
{
// Create a group
$fm = $this->ci->factory;
$group2 = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group2 = $fm->create(Group::class);

// Set post data
$data = [
Expand Down Expand Up @@ -651,7 +651,7 @@ public function testUpdateInfoWithDuplicateName(GroupController $controller)
{
// Create a group
$fm = $this->ci->factory;
$group2 = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group');
$group2 = $fm->create(Group::class);

// Set post data
$data = [
Expand All @@ -675,19 +675,19 @@ public function testUpdateInfoWithDuplicateName(GroupController $controller)
/**
* @return GroupController
*/
private function getController(): GroupController
protected function getController(): GroupController
{
return new GroupController($this->ci);
}

private function setupUser(): void
protected function setupUser(): void
{
// Admin user, WILL have access
$this->createTestUser(true, true);

// Create test role
$fm = $this->ci->factory;
$fm->create('UserFrosting\Sprinkle\Account\Database\Models\Group', [
$fm->create(Group::class, [
'slug' => 'foo',
'name' => 'bar',
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,12 @@ public function testpageListWithNoPermission(PermissionController $controller)
/**
* @return PermissionController
*/
private function getController()
protected function getController()
{
return new PermissionController($this->ci);
}

private function setupUser()
protected function setupUser()
{
$this->createTestUser(false, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace UserFrosting\Sprinkle\Admin\Tests\Integration\Controller;

use UserFrosting\Sprinkle\Account\Database\Models\Permission;
use UserFrosting\Sprinkle\Account\Tests\withTestUser;
use UserFrosting\Sprinkle\Admin\Controller\PermissionController;
use UserFrosting\Sprinkle\Core\Tests\RefreshDatabase;
Expand Down Expand Up @@ -162,19 +163,19 @@ public function testpageList(PermissionController $controller)
/**
* @return PermissionController
*/
private function getController()
protected function getController()
{
return new PermissionController($this->ci);
}

private function setupUser()
protected function setupUser()
{
// Admin user, WILL have access
$testUser = $this->createTestUser(true, true);

// Create test Permission
$fm = $this->ci->factory;
$permission = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Permission', [
$permission = $fm->create(Permission::class, [
'slug' => 'foo',
'name' => 'bar',
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace UserFrosting\Sprinkle\Admin\Tests\Integration\Controller;

use UserFrosting\Sprinkle\Account\Database\Models\Role;
use UserFrosting\Sprinkle\Account\Tests\withTestUser;
use UserFrosting\Sprinkle\Admin\Controller\RoleController;
use UserFrosting\Sprinkle\Core\Tests\TestDatabase;
Expand Down Expand Up @@ -278,19 +279,19 @@ public function testUpdateInfoWithNoRole(RoleController $controller)
/**
* @return RoleController
*/
private function getController()
protected function getController()
{
return new RoleController($this->ci);
}

private function setupUser()
protected function setupUser()
{
// Guest user, won't have any access
$testUser = $this->createTestUser(false, true);

// Create test role
$fm = $this->ci->factory;
$role = $fm->create('UserFrosting\Sprinkle\Account\Database\Models\Role', [
$role = $fm->create(Role::class, [
'slug' => 'foo',
'name' => 'bar',
]);
Expand Down
Loading

0 comments on commit 90f3790

Please sign in to comment.