Exemplo n.º 1
0
 function restrictAccess()
 {
     $this->action->givenTheAction('foo');
     $this->action->givenTheAction('bar');
     $access = Mockster::of(AccessControl::class);
     Mockster::stub($access->isVisible('bar'))->will()->return_(true);
     WebApplication::init(function (WebApplication $application) use($access) {
         $application->restrictAccess(WebAccessControl::factory(Mockster::mock($access)));
     }, $this->web->factory);
     $this->whenIListTheActions();
     $this->thenThereShouldBe_Actions(1);
     $this->thenAction_ShouldBe(1, 'bar');
 }
Exemplo n.º 2
0
 function redirectToAcquirePermission()
 {
     $this->action->givenTheAction('foo');
     $access = Mockster::of(AccessControl::class);
     Mockster::stub($access->isVisible('foo'))->will()->return_(true);
     WebApplication::init(function (WebApplication $app) use($access) {
         $app->restrictAccess(WebAccessControl::factory(Mockster::mock($access), function (WebRequest $request) {
             return $request->getContext()->appended('acquire_this');
         }));
     }, $this->web->factory);
     $this->whenIExecute('foo');
     $this->assert($this->web->model['redirect'], 'http://example.com/base/acquire_this');
 }
Exemplo n.º 3
0
 /**
  * @param Factory $factory <-
  * @param ActionRegistry $actions <-
  * @param FieldRegistry $fields <-
  * @param RendererRegistry $renderers <-
  * @param LinkRegistry $links <-
  * @param IdentifiersProvider $identifiers <-
  * @param TypeFactory $types <-
  * @param MobileDetector $detect <-
  * @param WebCommentParser $parser <-
  */
 public function __construct(Factory $factory, ActionRegistry $actions, FieldRegistry $fields, RendererRegistry $renderers, LinkRegistry $links, IdentifiersProvider $identifiers, TypeFactory $types, MobileDetector $detect, WebCommentParser $parser)
 {
     $factory->setSingleton($this);
     $this->factory = $factory;
     $this->actions = $actions;
     $this->renderers = $renderers;
     $this->links = $links;
     $this->types = $types;
     $this->fields = $fields;
     $this->identifiers = $identifiers;
     $this->detector = $detect;
     $this->parser = $parser;
     $this->menu = new Menu($actions);
     $this->accessFactory = WebAccessControl::factory(new NoneAccessControl());
 }