Skip to content

Commit

Permalink
Merge pull request #108 from magento-arcticfoxes/MC-22176
Browse files Browse the repository at this point in the history
[arcticfoxes] MC-19649: Granular ACL for B2B modules
  • Loading branch information
joanhe authored Oct 31, 2019
2 parents 65763df + b0382ec commit 45977bc
Showing 1 changed file with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ abstract class AbstractBackendController extends \Magento\TestFramework\TestCase
*/
protected $httpMethod;

/**
* Expected no access response
*
* @var int
*/
protected $expectedNoAccessResponseCode = 403;

/**
* @inheritDoc
*
Expand Down Expand Up @@ -84,21 +91,6 @@ protected function tearDown()
parent::tearDown();
}

/**
* Utilize backend session model by default
*
* @param \PHPUnit\Framework\Constraint\Constraint $constraint
* @param string|null $messageType
* @param string $messageManagerClass
*/
public function assertSessionMessages(
\PHPUnit\Framework\Constraint\Constraint $constraint,
$messageType = null,
$messageManagerClass = \Magento\Framework\Message\Manager::class
) {
parent::assertSessionMessages($constraint, $messageType, $messageManagerClass);
}

/**
* Test ACL configuration for action working.
*/
Expand All @@ -111,8 +103,8 @@ public function testAclHasAccess()
$this->getRequest()->setMethod($this->httpMethod);
}
$this->dispatch($this->uri);
$this->assertNotSame(403, $this->getResponse()->getHttpResponseCode());
$this->assertNotSame(404, $this->getResponse()->getHttpResponseCode());
$this->assertNotSame($this->expectedNoAccessResponseCode, $this->getResponse()->getHttpResponseCode());
}

/**
Expand All @@ -130,6 +122,6 @@ public function testAclNoAccess()
->getAcl()
->deny(null, $this->resource);
$this->dispatch($this->uri);
$this->assertSame(403, $this->getResponse()->getHttpResponseCode());
$this->assertSame($this->expectedNoAccessResponseCode, $this->getResponse()->getHttpResponseCode());
}
}

0 comments on commit 45977bc

Please sign in to comment.