public function testCreateDefault() { $default = 'Magento\\Framework\\Validator'; $returnMock = $this->getMock($default); $this->objectManagerMock->expects($this->once())->method('create')->willReturn($returnMock); $this->assertSame($returnMock, $this->model->create()); }
public function testCreate() { $redirect = $this->getMockBuilder('Magento\\Framework\\Controller\\Result\\Redirect')->disableOriginalConstructor()->getMock(); $this->objectManagerMock->expects($this->once())->method('create')->willReturn($redirect); $resultRedirect = $this->model->create(); $this->assertInstanceOf('Magento\\Framework\\Controller\\Result\\Redirect', $resultRedirect); $this->assertSame($redirect, $resultRedirect); }
/** * Set session.cookie_domain * * @param string $cookieDomain * @param string|null $default * @return $this */ public function setCookieDomain($cookieDomain, $default = null) { $validator = $this->_validatorFactory->create([], 'Magento\\Framework\\Session\\Config\\Validator\\CookieDomainValidator'); if ($validator->isValid($cookieDomain)) { $this->setOption('session.cookie_domain', $cookieDomain); } elseif (null !== $default && $validator->isValid($default)) { $this->setOption('session.cookie_domain', $default); } return $this; }
/** * Get validator instance * * @return \Magento\Framework\Validator */ protected function _createValidatorInstance() { $validator = $this->_validatorFactory->create(); foreach ($this->_constraints as $constraintData) { // https://jira.corp.x.com/browse/MAGETWO-10439 $breakChainOnFailure = !empty($constraintData['options']['breakChainOnFailure']); $validator->addValidator($this->_createConstraint($constraintData), $breakChainOnFailure); } return $validator; }
public function testCreateDefault() { $default = 'Magento\\Framework\\Validator'; $this->assertInstanceOf($default, $this->model->create()); }