-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding fix for Role feature state check
Backporting #2851
- Loading branch information
Showing
5 changed files
with
93 additions
and
1 deletion.
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
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
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,5 @@ | ||
<?php | ||
|
||
return array( | ||
'rolesNotEnabled' => 'The roles feature is not enabled for your deployment.' | ||
); |
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
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,53 @@ | ||
<?php | ||
|
||
/** | ||
* Unit tests for Signature Verifier | ||
* | ||
* @author Ushahidi Team <team@ushahidi.com> | ||
* @package Ushahidi\Application\Tests | ||
* @copyright 2013 Ushahidi | ||
* @license https://www.gnu.org/licenses/agpl-3.0.html GNU Affero General Public License Version 3 (AGPL3) | ||
*/ | ||
|
||
namespace Tests\Unit\Core\Tool; | ||
|
||
use Ushahidi_Validator_Role_Update; | ||
use Ushahidi\Core\Entity\PermissionRepository; | ||
|
||
/** | ||
* @backupGlobals disabled | ||
* @preserveGlobalState disabled | ||
*/ | ||
class RoleUpdateTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
|
||
public function testRoleDisabled() | ||
{ | ||
$validationMock = $this->createMock(\Validation::class); | ||
|
||
$validator = new Ushahidi_Validator_Role_Update($this->createMock(PermissionRepository::class), false); | ||
$validationMock | ||
->expects($this->once()) | ||
->method('error') | ||
->with( | ||
'name', | ||
'rolesNotEnabled' | ||
); | ||
$validator->checkRolesEnabled($validationMock); | ||
} | ||
|
||
public function testRoleEnabled() | ||
{ | ||
$validationMock = $this->createMock(\Validation::class); | ||
$validator = new Ushahidi_Validator_Role_Update($this->createMock(PermissionRepository::class), true); | ||
$validationMock | ||
->expects($this->never()) | ||
->method('error') | ||
// ->with( | ||
// 'name', | ||
// 'rolesNotEnabled' | ||
// ) | ||
; | ||
$validator->checkRolesEnabled($validationMock); | ||
} | ||
} |