/** * Constructor for the integer validator * * Accepts either a string locale, a Zend_Locale object, or an array or * Zend_Config object containing the keys "locale" and/or "format". * * @param string|Zend_Locale|array|\Zend\Config\Config $options * @throws \Zend\Validator\Exception On empty format */ public function __construct($options = null) { if ($options instanceof \Zend\Config\Config) { $options = $options->toArray(); } if (empty($options)) { if (\Zend\Registry::isRegistered('Zend_Locale')) { $this->setLocale(\Zend\Registry::get('Zend_Locale')); } } elseif (is_array($options)) { // Received if (array_key_exists('locale', $options)) { $this->setLocale($options['locale']); } if (array_key_exists('format', $options)) { $this->setFormat($options['format']); } } elseif ($options instanceof Locale\Locale || is_string($options)) { // Received Locale object or string locale $this->setLocale($options); } $format = $this->getFormat(); if (empty($format)) { throw new Exception\InvalidArgumentException("A postcode-format string has to be given for validation"); } }
public function setUp() { $this->forceAutoloader(); $this->error = false; $this->manager = new SessionManager(); Registry::_unsetInstance(); }
/** * Returns TRUE if the $index is a named value in the registry, * or FALSE if $index was not found in the registry. * * @param string $index * @return boolean */ public static function isRegistered($index) { if (self::$_registry === null) { return false; } return self::$_registry->offsetExists($index); }
/** * Sets validator options * * @param null|string|Locale|array|Traversable $locale OPTIONAL * @return void */ public function __construct($locale = null) { $options = array(); if ($locale instanceof Traversable) { $locale = IteratorToArray::convert($locale); } if (is_array($locale)) { $options = $locale; if (array_key_exists('locale', $locale)) { $locale = $locale['locale']; unset($options['locale']); } else { $locale = null; } } if (empty($locale) && $locale !== false) { if (Registry::isRegistered('Zend_Locale')) { $locale = Registry::get('Zend_Locale'); } } if ($locale !== null) { $this->setLocale($locale); } parent::__construct($options); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Registry::_unsetInstance(); DojoHelper::setUseDeclarative(); $this->view = $this->getView(); }
/** * Sets validator options * * @param string|array|Traversable $options OPTIONAL * @return void */ public function __construct($options = array()) { if ($options instanceof Traversable) { $options = IteratorToArray::convert($options); } elseif (!is_array($options)) { $options = func_get_args(); $temp['format'] = array_shift($options); if (!empty($options)) { $temp['locale'] = array_shift($options); } $options = $temp; } if (array_key_exists('format', $options)) { $this->setFormat($options['format']); } if (!array_key_exists('locale', $options)) { if (Registry::isRegistered('Zend_Locale')) { $options['locale'] = Registry::get('Zend_Locale'); } } if (array_key_exists('locale', $options)) { $this->setLocale($options['locale']); } parent::__construct($options); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Registry::_unsetInstance(); DojoHelper::setUseDeclarative(); $this->view = $this->getView(); $this->helper = new TextareaHelper(); $this->helper->setView($this->view); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Registry::_unsetInstance(); DojoHelper::setUseDeclarative(); $this->view = $this->getView(); $this->helper = new AccordionContainerHelper(); $this->helper->setView($this->view); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { $registry = Registry::getInstance(); if (isset($registry['Zend\\Dojo\\View\\Helper\\Dojo'])) { unset($registry['Zend\\Dojo\\View\\Helper\\Dojo']); } $this->view = new View\PhpRenderer(); \Zend\Dojo\Dojo::enableView($this->view); }
/** * Constructor for manually handling * * @param \Zend\Currency\Currency $currency Instance of \Zend\Currency\Currency * @return void */ public function __construct($currency = null) { if ($currency === null) { if (\Zend\Registry::isRegistered('Zend_Currency')) { $currency = \Zend\Registry::get('Zend_Currency'); } } $this->setCurrency($currency); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Registry::_unsetInstance(); $this->view = $this->getView(); $this->helper = new DojoContainer(); $this->helper->setView($this->view); Registry::set('Zend\Dojo\View\Helper\Dojo', $this->helper); DojoHelper::setUseProgrammatic(); }
public function setup() { Reader\Reader::reset(); if (\Zend\Registry::isRegistered('Zend_Locale')) { $registry = \Zend\Registry::getInstance(); unset($registry['Zend_Locale']); } $this->_feedSamplePath = dirname(__FILE__) . '/_files/Common'; }
public function testMultiplePlaceholdersUseSameRegistry() { $this->assertTrue(Registry::isRegistered(PlaceholderRegistry::REGISTRY_KEY)); $registry = Registry::get(PlaceholderRegistry::REGISTRY_KEY); $this->assertSame($registry, $this->placeholder->getRegistry()); $placeholder = new Helper\Placeholder(); $this->assertSame($registry, $placeholder->getRegistry()); $this->assertSame($this->placeholder->getRegistry(), $placeholder->getRegistry()); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Registry::_unsetInstance(); DojoHelper::setUseDeclarative(); $this->view = $this->getView(); $this->decorator = new TabContainerDecorator(); $this->element = $this->getElement(); $this->element->setView($this->view); $this->decorator->setElement($this->element); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { if (\Zend\Registry::isRegistered('Zend_View_Helper_Doctype')) { $registry = \Zend\Registry::getInstance(); unset($registry['Zend_View_Helper_Doctype']); } $this->view = new \Zend\View\PhpRenderer(); $this->helper = new \Zend\View\Helper\FormFile(); $this->helper->setView($this->view); }
public function setUp() { if (Registry::isRegistered('Zend_Locale')) { $registry = Registry::getInstance(); unset($registry['Zend_Locale']); } Cldr::removeCache(); $this->_locale = setlocale(LC_ALL, 0); setlocale(LC_ALL, 'de'); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { $regKey = Registry::REGISTRY_KEY; if (\Zend\Registry::isRegistered($regKey)) { $registry = \Zend\Registry::getInstance(); unset($registry[$regKey]); } $this->basePath = __DIR__ . '/_files/modules'; $this->helper = new Helper\HeadStyle(); }
/** * Constructor * * Map constants to doctype strings, and set default doctype */ public function __construct() { if (!Registry::isRegistered($this->_regKey)) { $this->_registry = new ArrayObject(array('doctypes' => array(self::XHTML11 => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">', self::XHTML1_RDFA1 => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">', self::XHTML1_STRICT => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">', self::XHTML1_TRANSITIONAL => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">', self::XHTML1_FRAMESET => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">', self::XHTML_BASIC1 => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">', self::XHTML5 => '<!DOCTYPE html>', self::HTML4_STRICT => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', self::HTML4_LOOSE => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">', self::HTML4_FRAMESET => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">', self::HTML5 => '<!DOCTYPE html>'))); Registry::set($this->_regKey, $this->_registry); $this->setDoctype($this->_defaultDoctype); } else { $this->_registry = Registry::get($this->_regKey); } }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { $regKey = Registry\Registry::REGISTRY_KEY; if (\Zend\Registry::isRegistered($regKey)) { $registry = \Zend\Registry::getInstance(); unset($registry[$regKey]); } $this->basePath = dirname(__FILE__) . '/_files/modules'; $this->helper = new Helper\InlineScript(); }
public function setUp() { Registry::_unsetInstance(); Form::setDefaultTranslator(null); if (isset($this->error)) { unset($this->error); } $this->loader = new PluginLoader(array('Zend\\Form\\Decorator' => 'Zend/Form/Decorator')); $this->group = new DisplayGroup('test', $this->loader); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { if (Registry::isRegistered('Zend_View_Helper_Doctype')) { $registry = Registry::getInstance(); unset($registry['Zend_View_Helper_Doctype']); } $this->view = new View(); $this->helper = new FormMultiCheckbox(); $this->helper->setView($this->view); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { if (Registry::isRegistered('Zend_View_Helper_Doctype')) { $registry = Registry::getInstance(); unset($registry['Zend_View_Helper_Doctype']); } $this->view = new View(); $this->helper = new FormTextHelper(); $this->helper->setView($this->view); }
/** * Retrieve or create registry instnace * * @return void */ public static function getRegistry() { if (\Zend\Registry::isRegistered(self::REGISTRY_KEY)) { $registry = \Zend\Registry::get(self::REGISTRY_KEY); } else { $registry = new self(); \Zend\Registry::set(self::REGISTRY_KEY, $registry); } return $registry; }
/** * Initialize helper * * Retrieve container from registry or create new container and store in * registry. * * @return void */ public function __construct() { $registry = Registry::getInstance(); $key = __CLASS__; if (!isset($registry[$key])) { $container = new Dojo\Container(); $registry[$key] = $container; } $this->_container = $registry[$key]; }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { if (\Zend\Registry::isRegistered('Zend_View_Helper_Doctype')) { $registry = \Zend\Registry::getInstance(); unset($registry['Zend_View_Helper_Doctype']); } $this->view = new \Zend\View\View(); $this->helper = new \Zend\View\Helper\FormReset(); $this->helper->setView($this->view); }
public function setUp() { // Necessary to ensure placeholders do not persist between individual tests if (Registry::isRegistered(PlaceholderRegistry::REGISTRY_KEY)) { Registry::getInstance()->offsetUnset(PlaceholderRegistry::REGISTRY_KEY); } $this->renderer = new PhpRenderer(); $this->strategy = new PhpRendererStrategy($this->renderer); $this->event = new ViewEvent(); $this->response = new HttpResponse(); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { Registry::_unsetInstance(); DojoHelper::setUseDeclarative(); $this->errors = array(); $this->view = $this->getView(); $this->decorator = new DijitElementDecorator(); $this->element = $this->getElement(); $this->element->setView($this->view); $this->decorator->setElement($this->element); }
/** * @group ZF-7352 */ public function testTranslationIsAddedIfRegistryKeyExistsAlready() { $options1 = array('foo' => 'bar'); $options2 = array_merge_recursive($this->_translationOptions, array('content' => array('message4' => 'bericht4'))); $translate = new \Zend\Translator\Translator(\Zend\Translator\Translator::AN_ARRAY, $options1); Registry::set('Zend_Translator', $translate); $resource = new TranslateResource($options2); $this->assertTrue($translate === $resource->getTranslate()); $this->assertEquals('bar', $translate->translate('foo')); $this->assertEquals('bericht4', $translate->translate('message4')); $this->assertEquals('shouldNotExist', $translate->translate('shouldNotExist')); }
/** * Constructor * * @param string $value * @param array $columns * @param array|string $cache * @param string $criteria */ public function __construct($value, $columns, $cache, $criteria = self::CRITERIA_BEGINS) { parent::__construct($columns, $value); if (empty($cache)) { $this->_cache = false; } elseif (is_array($cache)) { $this->_cache = $cache; } else { $this->_cache = \Zend\Registry::get($cache); } $this->_criteria = $criteria; $this->_setValue(); }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @return void */ public function setUp() { foreach (array(Registry\Registry::REGISTRY_KEY, 'Zend_View_Helper_Doctype') as $key) { if (\Zend\Registry::isRegistered($key)) { $registry = \Zend\Registry::getInstance(); unset($registry[$key]); } } $this->basePath = dirname(__FILE__) . '/_files/modules'; $this->view = new View\View(); $this->helper = new Helper\HeadLink(); $this->helper->setView($this->view); }