/** * @param bool $isGrantedAdd * @param bool $expected * @param bool $isGrantedEdit * @param ShoppingList|null $shoppingList * * @dataProvider isAllowedDataProvider */ public function testIsAllowed($isGrantedAdd, $expected, ShoppingList $shoppingList = null, $isGrantedEdit = false) { $this->securityFacade->expects($this->once())->method('hasLoggedUser')->willReturn(true); $this->securityFacade->expects($this->at(1))->method('isGranted')->with('orob2b_shopping_list_line_item_frontend_add')->willReturn($isGrantedAdd); if ($shoppingList && $isGrantedAdd) { $this->securityFacade->expects($this->at(2))->method('isGranted')->with('EDIT', $shoppingList)->willReturn($isGrantedEdit); } $this->assertEquals($expected, $this->handler->isAllowed($shoppingList)); }
/** {@inheritdoc} */ public function isAllowed() { return $this->shoppingListLineItemHandler->isAllowed(); }