Browse Source

added failing test for #13593

tags/2.0.12
Carsten Brandt 7 years ago
parent
commit
3e94919592
No known key found for this signature in database
GPG Key ID: BE4F41DE1DEEEED0
  1. 1
      tests/framework/rbac/DbManagerTestCase.php
  2. 20
      tests/framework/rbac/ManagerTestCase.php

1
tests/framework/rbac/DbManagerTestCase.php

@ -105,7 +105,6 @@ abstract class DbManagerTestCase extends ManagerTestCase
{
$db = new Connection;
$db->dsn = static::$database['dsn'];
echo "\n" . $db->dsn . "\n";
if (isset(static::$database['username'])) {
$db->username = static::$database['username'];
$db->password = static::$database['password'];

20
tests/framework/rbac/ManagerTestCase.php

@ -213,6 +213,7 @@ abstract class ManagerTestCase extends TestCase
$this->auth->add($uniqueTrait);
$createPost = $this->auth->createPermission('createPost');
$createPost->data = 'createPostData';
$createPost->description = 'create a post';
$this->auth->add($createPost);
@ -241,6 +242,7 @@ abstract class ManagerTestCase extends TestCase
$this->auth->addChild($reader, $readPost);
$author = $this->auth->createRole('author');
$author->data = 'authorData';
$this->auth->add($author);
$this->auth->addChild($author, $createPost);
$this->auth->addChild($author, $updatePost);
@ -281,6 +283,24 @@ abstract class ManagerTestCase extends TestCase
}
}
public function testGetRole()
{
$this->prepareData();
$author = $this->auth->getRole('author');
$this->assertEquals(Item::TYPE_ROLE, $author->type);
$this->assertEquals('author', $author->name);
$this->assertEquals('authorData', $author->data);
}
public function testGetPermission()
{
$this->prepareData();
$createPost = $this->auth->getPermission('createPost');
$this->assertEquals(Item::TYPE_PERMISSION, $createPost->type);
$this->assertEquals('createPost', $createPost->name);
$this->assertEquals('createPostData', $createPost->data);
}
public function testGetRolesByUser()
{
$this->prepareData();

Loading…
Cancel
Save