/** * @param array $context * @param Post $post * * @return bool */ public function isPostPasswordRequired(array $context, Post $post) { if (null === $this->cookieHash) { $this->cookieHash = ''; if ($siteUrlOption = $this->optionExtension->getOption('siteurl')) { $this->cookieHash = md5($siteUrlOption->getValue()); } } return $this->postManager->isPasswordRequired($post, $context['app']->getRequest(), $this->cookieHash); }
/** * Check the usage of default return value for a non existing option. */ public function testGetOptionUndefined() { $this->optionManager->expects($this->once())->method('findOneByOptionName')->with($this->equalTo('test'))->will($this->returnValue(null)); $result = $this->extension->getOption('test', 'poney'); $this->assertEquals('poney', $result); }