protected function assert($value, $operator, $expected) { $businessEntity = null; if ($this->currentViewHelper->getCurrentView() instanceof BusinessPage) { $businessEntity = $this->currentViewHelper->getCurrentView()->getBusinessEntity(); } $result = false; switch ($operator) { case self::OPERAND_EQUAL: $result = $value === $expected; break; case self::OPERAND_TRUE: $result = $value == true; break; case self::OPERAND_FALSE: $result = $value == false; break; case self::OPERAND_IN: $result = in_array($value, unserialize($expected)); break; case self::IS_GRANTED: case self::IS_NOT_GRANTED: if (!$this->authorizationChecker->isGranted('ROLE_VICTOIRE')) { $granted = $this->authorizationChecker->isGranted($expected, $businessEntity); if ($operator === self::IS_GRANTED) { $result = $granted; } else { $result = false === $granted; } } else { $result = true; } break; } return $result; }
public function testGetCurrentView() { $currentViewHelper = new CurrentViewHelper(); $this->assertEquals(null, $currentViewHelper->getCurrentView()); }