+ /**
+ * @param string $notAllowedAction
+ * @return PHPUnit_Framework_MockObject_MockObject|PermissionManager
+ */
+ private function getMockPermissionManager( $notAllowedAction = null ) {
+ $mock = $this->getMockBuilder( PermissionManager::class )
+ ->disableOriginalConstructor()
+ ->getMock();
+ $mock->method( 'userHasRight' )
+ ->will( $this->returnCallback( function ( $user, $action ) use ( $notAllowedAction ) {
+ return $action !== $notAllowedAction;
+ } ) );
+ $mock->method( 'userHasAnyRight' )
+ ->will( $this->returnCallback( function ( $user, ...$actions ) use ( $notAllowedAction ) {
+ return !in_array( $notAllowedAction, $actions );
+ } ) );
+ return $mock;
+ }
+