From 519dd9329a5444709057090ff3801be8ca7a01b7 Mon Sep 17 00:00:00 2001 From: marc-mabe Date: Sat, 31 Jul 2010 20:36:33 +0200 Subject: [PATCH 01/19] fixed default serializer (PHPSerialize -> PhpSerialize) + make test fail if default serializer has a wrong case --- library/Zend/Serializer/Serializer.php | 2 +- tests/Zend/Serializer/SerializerTest.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/library/Zend/Serializer/Serializer.php b/library/Zend/Serializer/Serializer.php index 9db4567c1c5..c71e4251019 100644 --- a/library/Zend/Serializer/Serializer.php +++ b/library/Zend/Serializer/Serializer.php @@ -49,7 +49,7 @@ class Serializer * * @var string|Zend\Serializer\Adapter */ - protected static $_defaultAdapter = 'PHPSerialize'; + protected static $_defaultAdapter = 'PhpSerialize'; /** * Create a serializer adapter instance. diff --git a/tests/Zend/Serializer/SerializerTest.php b/tests/Zend/Serializer/SerializerTest.php index 77a55c4065d..d716f741dbb 100644 --- a/tests/Zend/Serializer/SerializerTest.php +++ b/tests/Zend/Serializer/SerializerTest.php @@ -40,11 +40,11 @@ class SerializerTest extends \PHPUnit_Framework_TestCase { public function setUp() { - Serializer::resetAdapterLoader(); } public function tearDown() { + Serializer::resetAdapterLoader(); } public function testGetDefaultAdapterLoader() @@ -59,6 +59,12 @@ public function testChangeAdapterLoader() $this->assertTrue(Serializer::getAdapterLoader() === $newLoader); } + public function testDefaultAdapter() + { + $adapter = Serializer::getDefaultAdapter(); + $this->assertTrue($adapter instanceof Adapter); + } + public function testFactoryValidCall() { $serializer = Serializer::factory('PhpSerialize'); @@ -78,12 +84,6 @@ public function testFactoryOnADummyClassAdapter() Serializer::factory('dummy'); } - public function testDefaultAdapter() - { - $adapter = Serializer::getDefaultAdapter(); - $this->assertTrue($adapter instanceof Adapter); - } - public function testChangeDefaultAdapterWithString() { Serializer::setDefaultAdapter('Json'); From b8211d5ba2a976d7c84f518c13d7f347e5b4ada2 Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Sun, 1 Aug 2010 14:13:44 +0100 Subject: [PATCH 02/19] Added Tag URI support to Zend\Feed\Writer --- library/Zend/Feed/Writer/AbstractFeed.php | 41 +++++++++++++++++++++-- library/Zend/Feed/Writer/Feed.php | 2 +- tests/ZendTest/Feed/Writer/FeedTest.php | 14 ++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/library/Zend/Feed/Writer/AbstractFeed.php b/library/Zend/Feed/Writer/AbstractFeed.php index 3d2bf4a494f..06254c23aca 100644 --- a/library/Zend/Feed/Writer/AbstractFeed.php +++ b/library/Zend/Feed/Writer/AbstractFeed.php @@ -25,6 +25,7 @@ namespace Zend\Feed\Writer; use Zend\Uri; use Zend\Date; +use Zend\Validator; /** * @uses \Zend\Date\Date @@ -32,8 +33,9 @@ * @uses \Zend\Feed\Writer\Writer * @uses \Zend\Feed\Writer\Entry * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom -* @uses \Zend\Feed\Writer\Renderer\Feed\RSS -* @uses \Zend\Uri\Uri +* @uses \Zend\Feed\Writer\Renderer\Feed\Rss +* @uses \Zend\Uri\Url +* @uses \Zend\Validator\EmailAddress * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) @@ -267,11 +269,44 @@ public function setGenerator($name, $version = null, $uri = null) public function setId($id) { if ((empty($id) || !is_string($id) || !Uri\Url::validate($id)) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id)) { + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $id) + && !$this->_validateTagUri($id)) { throw new Exception('Invalid parameter: parameter must be a non-empty string and valid URI/IRI'); } $this->_data['id'] = $id; } + + /** + * Validate a URI using the tag scheme (RFC 4151) + * + * @param string $id + * @return bool + */ + protected function _validateTagUri($id) + { + if (preg_match('/^tag:(?.*),(?\d{4}-?\d{0,2}-?\d{0,2}):(?.*)(.*:)*$/', $id, $matches)) { + $dvalid = false; + $nvalid = false; + $date = $matches['date']; + $d6 = strtotime($date); + if ((strlen($date) == 4) && $date <= date('Y')) { + $dvalid = true; + } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) { + $dvalid = true; + } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) { + $dvalid = true; + } + $validator = new Validator\EmailAddress; + if ($validator->isValid($matches['name'])) { + $nvalid = true; + } else { + $nvalid = $validator->isValid('info@' . $matches['name']); + } + return $dvalid && $nvalid; + + } + return false; + } /** * Set a feed image (URI at minimum). Parameter is a single array with the diff --git a/library/Zend/Feed/Writer/Feed.php b/library/Zend/Feed/Writer/Feed.php index cedc7908bca..caf58bcf44a 100644 --- a/library/Zend/Feed/Writer/Feed.php +++ b/library/Zend/Feed/Writer/Feed.php @@ -37,7 +37,7 @@ * @uses \Zend\Feed\Writer\Feed\FeedAbstract * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Atom * @uses \Zend\Feed\Writer\Renderer\Feed\RSS -* @uses \Zend\Uri\Uri +* @uses \Zend\Uri\Url * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) diff --git a/tests/ZendTest/Feed/Writer/FeedTest.php b/tests/ZendTest/Feed/Writer/FeedTest.php index a9b1f3b1ca0..f356d1c99e8 100644 --- a/tests/ZendTest/Feed/Writer/FeedTest.php +++ b/tests/ZendTest/Feed/Writer/FeedTest.php @@ -350,6 +350,20 @@ public function testSetsIdAcceptsUrns() $writer->setId('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6'); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $writer->getId()); } + + public function testSetsIdAcceptsSimpleTagUri() + { + $writer = new Writer\Feed; + $writer->setId('tag:example.org,2010:/foo/bar/'); + $this->assertEquals('tag:example.org,2010:/foo/bar/', $writer->getId()); + } + + public function testSetsIdAcceptsComplexTagUri() + { + $writer = new Writer\Feed; + $writer->setId('tag:diveintomark.org,2004-05-27:/archives/2004/05/27/howto-atom-linkblog'); + $this->assertEquals('tag:diveintomark.org,2004-05-27:/archives/2004/05/27/howto-atom-linkblog', $writer->getId()); + } public function testSetIdThrowsExceptionOnInvalidParameter() { From e321b39f09eb13013f874d8e6109471977a22944 Mon Sep 17 00:00:00 2001 From: Padraic Brady Date: Sun, 1 Aug 2010 20:21:09 +0100 Subject: [PATCH 03/19] Added Tag URI support when rendering Atom Entries - fixes ZF-10246 --- .../Zend/Feed/Writer/Renderer/Entry/Atom.php | 40 ++++++++++++++++++- .../Feed/Writer/Renderer/Entry/AtomTest.php | 18 +++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/library/Zend/Feed/Writer/Renderer/Entry/Atom.php b/library/Zend/Feed/Writer/Renderer/Entry/Atom.php index 47fbc05a0ab..68d6f2f6bdf 100644 --- a/library/Zend/Feed/Writer/Renderer/Entry/Atom.php +++ b/library/Zend/Feed/Writer/Renderer/Entry/Atom.php @@ -27,6 +27,7 @@ use Zend\Feed\Writer; use Zend\Date; use Zend\URI; +use Zend\Validator; /** * @uses DOMDocument @@ -36,7 +37,8 @@ * @uses \Zend\Feed\Writer\Renderer\Feed\Atom\Source * @uses \Zend\Feed\Writer\Renderer\RendererAbstract * @uses \Zend\Feed\Writer\Renderer\RendererInterface -* @uses \Zend\Uri\Uri +* @uses \Zend\Uri\Url +* @uses \Zend\Validator * @uses tidy * @category Zend * @package Zend_Feed_Writer @@ -292,7 +294,9 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) $this->getDataContainer()->getLink()); } if (!URI\URL::validate($this->getDataContainer()->getId()) && - !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", $this->getDataContainer()->getId())) { + !preg_match("#^urn:[a-zA-Z0-9][a-zA-Z0-9\-]{1,31}:([a-zA-Z0-9\(\)\+\,\.\:\=\@\;\$\_\!\*\-]|%[0-9a-fA-F]{2})*#", + $this->getDataContainer()->getId() + ) && !$this->_validateTagUri($this->getDataContainer()->getId())) { throw new Exception('Atom 1.0 IDs must be a valid URI/IRI'); } $id = $dom->createElement('id'); @@ -301,6 +305,38 @@ protected function _setId(\DOMDocument $dom, \DOMElement $root) $id->appendChild($text); } + /** + * Validate a URI using the tag scheme (RFC 4151) + * + * @param string $id + * @return bool + */ + protected function _validateTagUri($id) + { + if (preg_match('/^tag:(?.*),(?\d{4}-?\d{0,2}-?\d{0,2}):(?.*)(.*:)*$/', $id, $matches)) { + $dvalid = false; + $nvalid = false; + $date = $matches['date']; + $d6 = strtotime($date); + if ((strlen($date) == 4) && $date <= date('Y')) { + $dvalid = true; + } elseif ((strlen($date) == 7) && ($d6 < strtotime("now"))) { + $dvalid = true; + } elseif ((strlen($date) == 10) && ($d6 < strtotime("now"))) { + $dvalid = true; + } + $validator = new Validator\EmailAddress; + if ($validator->isValid($matches['name'])) { + $nvalid = true; + } else { + $nvalid = $validator->isValid('info@' . $matches['name']); + } + return $dvalid && $nvalid; + + } + return false; + } + /** * Set entry content * diff --git a/tests/Zend/Feed/Writer/Renderer/Entry/AtomTest.php b/tests/Zend/Feed/Writer/Renderer/Entry/AtomTest.php index a647f428b04..18783c0d63f 100644 --- a/tests/Zend/Feed/Writer/Renderer/Entry/AtomTest.php +++ b/tests/Zend/Feed/Writer/Renderer/Entry/AtomTest.php @@ -218,6 +218,24 @@ public function testEntryIdHasBeenSet() $entry = $feed->current(); $this->assertEquals('urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6', $entry->getId()); } + + public function testEntryIdHasBeenSetUsingSimpleTagUri() + { + $this->_validEntry->setId('tag:example.org,2010:/foo/bar/'); + $renderer = new Renderer\Feed\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('tag:example.org,2010:/foo/bar/', $entry->getId()); + } + + public function testEntryIdHasBeenSetUsingComplexTagUri() + { + $this->_validEntry->setId('tag:diveintomark.org,2004-05-27:/archives/2004/05/27/howto-atom-linkblog'); + $renderer = new Renderer\Feed\Atom($this->_validWriter); + $feed = Reader\Reader::importString($renderer->render()->saveXml()); + $entry = $feed->current(); + $this->assertEquals('tag:diveintomark.org,2004-05-27:/archives/2004/05/27/howto-atom-linkblog', $entry->getId()); + } public function testFeedIdDefaultIsUsedIfNotSetByHand() { From de94e40a034e6309ca012a50fb966b5bdf284ab0 Mon Sep 17 00:00:00 2001 From: Ralph Schindler Date: Mon, 2 Aug 2010 12:43:10 -0500 Subject: [PATCH 04/19] Various fixes in various components that facilitate a working MVC application Zend\Controller & Zend\Application now only run namespaced applications Zend\Controller now assumes default module is 'application' (Default is a reserved word) Zend\Log priority casting fix Zend\Db\Table fix for row type class check ZendTest\Filter\StripTagsTest fixed for duplicated test --- library/Zend/Application/Module/Bootstrap.php | 2 +- library/Zend/Application/Resource/Modules.php | 8 +- library/Zend/Controller/Action.php | 1 + .../Action/Helper/FlashMessenger.php | 2 +- .../Controller/Action/Helper/Redirector.php | 2 +- .../Controller/Action/Helper/ViewRenderer.php | 2 +- .../Dispatcher/AbstractDispatcher.php | 6 +- .../Zend/Controller/Dispatcher/Standard.php | 2 +- library/Zend/Controller/Router/Rewrite.php | 6 +- library/Zend/Db/Table/AbstractRow.php | 2 +- library/Zend/Log/Filter/Priority.php | 8 +- library/Zend/Log/Writer/Db.php | 2 +- library/Zend/Navigation/Page/Mvc.php | 4 +- .../Zend/Application/Module/BootstrapTest.php | 16 ++-- .../Resource/FrontcontrollerTest.php | 6 +- .../Zend/Application/Resource/ModulesTest.php | 6 +- .../TestAsset/ZfModuleBootstrap.php | 3 +- .../{default => application}/Bootstrap.php | 0 .../controllers/ErrorController.php | 0 .../TestAsset/modules/bar/Bootstrap.php | 3 +- .../TestAsset/modules/foo-bar/Bootstrap.php | 4 +- .../TestAsset/modules/foo/Bootstrap.php | 3 +- .../controllers/IndexController.php | 3 +- .../Action/Helper/RedirectorTest.php | 4 +- .../Zend/Controller/Action/Helper/UrlTest.php | 2 +- .../Action/Helper/ViewRendererTest.php | 72 +++++++++--------- .../Controller/Dispatcher/StandardTest.php | 23 +++--- tests/Zend/Controller/FrontTest.php | 6 +- .../Controller/Plugin/ErrorHandlerTest.php | 6 +- tests/Zend/Controller/Router/RewriteTest.php | 12 +-- .../Controller/Router/Route/ChainTest.php | 2 +- .../Controller/_files/Admin/BazController.php | 3 +- .../_files/Admin/FooBarController.php | 4 +- .../Controller/_files/Admin/FooController.php | 4 +- .../_files/ManuallyIncludedControllers.php | 48 +----------- .../ManuallyIncludedControllersNamespaced.php | 23 ++++++ .../controllers/Admin/HelperController.php | 4 +- .../views/helpers/SampleZfHelper.php | 4 +- .../views/scripts/admin/helper/render.phtml | 0 .../bar/controllers/IndexController.php | 3 +- .../foo/controllers/Admin/IndexController.php | 3 +- .../foo/controllers/IndexController.php | 3 +- .../foo/views/helpers/FooUseHelper.php | 4 +- tests/Zend/Filter/StripTagsTest.php | 12 --- tests/Zend/Log/Filter/PriorityTest.php | 4 +- tests/Zend/Log/Writer/DbTest.php | 13 ++-- tests/Zend/Log/Writer/ZendMonitorTest.php | 12 +-- tests/Zend/Paginator/_files/test.sqlite | Bin 10240 -> 10240 bytes tests/Zend/View/Helper/ActionTest.php | 2 +- .../Helper/Navigation/BreadcrumbsTest.php | 2 +- .../Zend/View/Helper/Navigation/MenuTest.php | 2 +- tests/Zend/View/Helper/PartialLoopTest.php | 22 +++--- tests/Zend/View/Helper/PartialTest.php | 14 ++-- .../controllers/ActionBarController.php | 0 .../controllers/ActionFooController.php | 0 .../views/scripts/action-bar/baz.phtml | 0 .../views/scripts/action-foo/bar.phtml | 0 .../views/scripts/action-foo/baz.phtml | 0 .../views/scripts/partialActionCall.phtml | 0 .../views/scripts/partialLoop.phtml | 0 .../views/scripts/partialLoopCouter.phtml | 0 .../views/scripts/partialLoopObject.phtml | 0 .../views/scripts/partialObj.phtml | 0 .../views/scripts/partialOne.phtml | 0 .../views/scripts/partialThree.phtml | 0 .../views/scripts/partialVars.phtml | 0 .../modules/foo/controllers/BazController.php | 4 +- .../modules/foo/controllers/FooController.php | 4 +- 68 files changed, 206 insertions(+), 206 deletions(-) rename tests/Zend/Application/TestAsset/modules/{default => application}/Bootstrap.php (100%) rename tests/Zend/Application/TestAsset/modules/{default => application}/controllers/ErrorController.php (100%) create mode 100644 tests/Zend/Controller/_files/ManuallyIncludedControllersNamespaced.php rename tests/Zend/Controller/_files/modules/{default => application}/controllers/Admin/HelperController.php (93%) rename tests/Zend/Controller/_files/modules/{default => application}/views/helpers/SampleZfHelper.php (92%) rename tests/Zend/Controller/_files/modules/{default => application}/views/scripts/admin/helper/render.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/controllers/ActionBarController.php (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/controllers/ActionFooController.php (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/action-bar/baz.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/action-foo/bar.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/action-foo/baz.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/partialActionCall.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/partialLoop.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/partialLoopCouter.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/partialLoopObject.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/partialObj.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/partialOne.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/partialThree.phtml (100%) rename tests/Zend/View/Helper/_files/modules/{default => application}/views/scripts/partialVars.phtml (100%) diff --git a/library/Zend/Application/Module/Bootstrap.php b/library/Zend/Application/Module/Bootstrap.php index 34515e46b7f..e647aed4a8d 100644 --- a/library/Zend/Application/Module/Bootstrap.php +++ b/library/Zend/Application/Module/Bootstrap.php @@ -118,7 +118,7 @@ public function getModuleName() { if (empty($this->_moduleName)) { $class = get_class($this); - if (preg_match('/^([a-z][a-z0-9]*)_/i', $class, $matches)) { + if (preg_match('/^([a-z][a-z0-9]*)\\\\/i', $class, $matches)) { $prefix = $matches[1]; } else { $prefix = $class; diff --git a/library/Zend/Application/Resource/Modules.php b/library/Zend/Application/Resource/Modules.php index 7eb846f523a..c6f669f5b8f 100644 --- a/library/Zend/Application/Resource/Modules.php +++ b/library/Zend/Application/Resource/Modules.php @@ -25,6 +25,8 @@ */ namespace Zend\Application\Resource; +use Zend\Application\Exception as Exception; + /** * Module bootstrapping resource * @@ -72,7 +74,7 @@ public function init() $default = $front->getDefaultModule(); $curBootstrapClass = get_class($bootstrap); foreach ($modules as $module => $moduleDirectory) { - $bootstrapClass = $this->_formatModuleName($module) . '_Bootstrap'; + $bootstrapClass = $this->_formatModuleName($module) . '\Bootstrap'; if (!class_exists($bootstrapClass, false)) { $bootstrapPath = dirname($moduleDirectory) . '/Bootstrap.php'; if (file_exists($bootstrapPath)) { @@ -81,14 +83,14 @@ public function init() if (($default != $module) && !class_exists($bootstrapClass, false) ) { - throw new xception(sprintf( + throw new Exception(sprintf( $eMsgTpl, $module, $bootstrapClass )); } elseif ($default == $module) { if (!class_exists($bootstrapClass, false)) { $bootstrapClass = 'Bootstrap'; if (!class_exists($bootstrapClass, false)) { - throw new xception(sprintf( + throw new Exception(sprintf( $eMsgTpl, $module, $bootstrapClass )); } diff --git a/library/Zend/Controller/Action.php b/library/Zend/Controller/Action.php index a18740093db..ef6729a9f89 100644 --- a/library/Zend/Controller/Action.php +++ b/library/Zend/Controller/Action.php @@ -280,6 +280,7 @@ public function getViewScript($action = null, $noController = null) $dispatcher = Front::getInstance()->getDispatcher(); $wordDelimiters = $dispatcher->getWordDelimiter(); $pathDelimiters = $dispatcher->getPathDelimiter(); + $pathDelimiters = array($pathDelimiters, '_'); $this->_delimiters = array_unique(array_merge($wordDelimiters, (array) $pathDelimiters)); } diff --git a/library/Zend/Controller/Action/Helper/FlashMessenger.php b/library/Zend/Controller/Action/Helper/FlashMessenger.php index 93cf617befb..8ac7ed57d1d 100644 --- a/library/Zend/Controller/Action/Helper/FlashMessenger.php +++ b/library/Zend/Controller/Action/Helper/FlashMessenger.php @@ -65,7 +65,7 @@ class FlashMessenger extends AbstractHelper implements \IteratorAggregate, \Coun * * @var string */ - protected $_namespace = 'default'; + protected $_namespace = 'application'; /** * __construct() - Instance constructor, needed to get iterators, etc diff --git a/library/Zend/Controller/Action/Helper/Redirector.php b/library/Zend/Controller/Action/Helper/Redirector.php index feeb45c1923..0db4b75b989 100644 --- a/library/Zend/Controller/Action/Helper/Redirector.php +++ b/library/Zend/Controller/Action/Helper/Redirector.php @@ -299,7 +299,7 @@ public function setGotoSimple($action, $controller = null, $module = null, array $params['action'] = $action; $router = $this->getFrontController()->getRouter(); - $url = $router->assemble($params, 'default', true); + $url = $router->assemble($params, 'application', true); $this->_redirect($url); } diff --git a/library/Zend/Controller/Action/Helper/ViewRenderer.php b/library/Zend/Controller/Action/Helper/ViewRenderer.php index 6afb90cca1f..612b1a5f417 100644 --- a/library/Zend/Controller/Action/Helper/ViewRenderer.php +++ b/library/Zend/Controller/Action/Helper/ViewRenderer.php @@ -345,7 +345,7 @@ protected function _generateDefaultPrefix() } $module = $this->getModule(); - if ('default' == $module) { + if ('application' == $module) { return $default; } diff --git a/library/Zend/Controller/Dispatcher/AbstractDispatcher.php b/library/Zend/Controller/Dispatcher/AbstractDispatcher.php index d18baa676ed..ce60aadc6bc 100644 --- a/library/Zend/Controller/Dispatcher/AbstractDispatcher.php +++ b/library/Zend/Controller/Dispatcher/AbstractDispatcher.php @@ -57,7 +57,7 @@ abstract class AbstractDispatcher implements Dispatcher * Default module * @var string */ - protected $_defaultModule = 'default'; + protected $_defaultModule = 'application'; /** * Front Controller instance @@ -76,7 +76,7 @@ abstract class AbstractDispatcher implements Dispatcher * Path delimiter character * @var string */ - protected $_pathDelimiter = '_'; + protected $_pathDelimiter = '\\'; /** * Response object to pass to action controllers, if any @@ -248,7 +248,7 @@ protected function _formatName($unformatted, $isAction = false) $segments[$key] = str_replace(' ', '', ucwords($segment)); } - return implode('_', $segments); + return implode('\\', $segments); } /** diff --git a/library/Zend/Controller/Dispatcher/Standard.php b/library/Zend/Controller/Dispatcher/Standard.php index 9190a462522..834e21c2f07 100644 --- a/library/Zend/Controller/Dispatcher/Standard.php +++ b/library/Zend/Controller/Dispatcher/Standard.php @@ -177,7 +177,7 @@ public function formatModuleName($unformatted) */ public function formatClassName($moduleName, $className) { - return $this->formatModuleName($moduleName) . '_' . $className; + return $this->formatModuleName($moduleName) . '\\' . $className; } /** diff --git a/library/Zend/Controller/Router/Rewrite.php b/library/Zend/Controller/Router/Rewrite.php index 24188146173..93803850544 100644 --- a/library/Zend/Controller/Router/Rewrite.php +++ b/library/Zend/Controller/Router/Rewrite.php @@ -91,14 +91,14 @@ class Rewrite extends AbstractRouter */ public function addDefaultRoutes() { - if (!$this->hasRoute('default')) { + if (!$this->hasRoute('application')) { $dispatcher = $this->getFrontController()->getDispatcher(); $request = $this->getFrontController()->getRequest(); require_once 'Zend/Controller/Router/Route/Module.php'; $compat = new Route\Module(array(), $dispatcher, $request); - $this->_routes = array_merge(array('default' => $compat), $this->_routes); + $this->_routes = array_merge(array('application' => $compat), $this->_routes); } return $this; @@ -456,7 +456,7 @@ public function assemble($userParams, $name = null, $reset = false, $encode = tr try { $name = $this->getCurrentRouteName(); } catch (Exception $e) { - $name = 'default'; + $name = 'application'; } } diff --git a/library/Zend/Db/Table/AbstractRow.php b/library/Zend/Db/Table/AbstractRow.php index 78125dee4da..2c3c6f33952 100644 --- a/library/Zend/Db/Table/AbstractRow.php +++ b/library/Zend/Db/Table/AbstractRow.php @@ -834,7 +834,7 @@ protected function _postDelete() */ protected function _prepareReference(AbstractTable $dependentTable, AbstractTable $parentTable, $ruleKey) { - $parentTableName = (get_class($parentTable) === 'Zend_Db_Table') ? $parentTable->getDefinitionConfigName() : get_class($parentTable); + $parentTableName = (get_class($parentTable) === 'Zend\Db\Table') ? $parentTable->getDefinitionConfigName() : get_class($parentTable); $map = $dependentTable->getReference($parentTableName, $ruleKey); if (!isset($map[AbstractTable::REF_COLUMNS])) { diff --git a/library/Zend/Log/Filter/Priority.php b/library/Zend/Log/Filter/Priority.php index 8d79b863413..256114f26a2 100644 --- a/library/Zend/Log/Filter/Priority.php +++ b/library/Zend/Log/Filter/Priority.php @@ -55,7 +55,7 @@ class Priority extends AbstractFilter * @param string $operator Comparison operator * @throws \Zend\Log\Exception */ - public function __construct($priority, $operator = \NULL) + public function __construct($priority, $operator = null) { if (! is_integer($priority)) { throw new \Zend\Log\Exception('Priority must be an integer'); @@ -85,8 +85,12 @@ static public function factory($config = array()) $config['priority'] = constant($config['priority']); } + if (!is_numeric($config['priority'])) { + throw new \Zend\Log\Exception('Priority must be an integer.'); + } + return new self( - $config['priority'], + (int) $config['priority'], $config['operator'] ); } diff --git a/library/Zend/Log/Writer/Db.php b/library/Zend/Log/Writer/Db.php index 78b95979e19..583d779cf3e 100644 --- a/library/Zend/Log/Writer/Db.php +++ b/library/Zend/Log/Writer/Db.php @@ -101,7 +101,7 @@ static public function factory($config = array()) /** * Formatting is not possible on this writer */ - public function setFormatter(Zend_Log_Formatter_Interface $formatter) + public function setFormatter(\Zend\Log\Formatter $formatter) { throw new Log\Exception(get_class() . ' does not support formatting'); } diff --git a/library/Zend/Navigation/Page/Mvc.php b/library/Zend/Navigation/Page/Mvc.php index cfc5f81c013..eddbf6f0640 100644 --- a/library/Zend/Navigation/Page/Mvc.php +++ b/library/Zend/Navigation/Page/Mvc.php @@ -177,7 +177,7 @@ public function getHref() if (null === self::$_urlHelper) { self::$_urlHelper = - \Zend\Controller\Action\HelperBroker::getStaticHelper('URL'); + \Zend\Controller\Action\HelperBroker::getStaticHelper('url'); } $params = $this->getParams(); @@ -197,7 +197,7 @@ public function getHref() $url = self::$_urlHelper->__invoke($params, $this->getRoute(), $this->getResetParams()); -//var_dump($url); + return $this->_hrefCache = $url; } diff --git a/tests/Zend/Application/Module/BootstrapTest.php b/tests/Zend/Application/Module/BootstrapTest.php index a292b7980ea..c30b7b50f06 100644 --- a/tests/Zend/Application/Module/BootstrapTest.php +++ b/tests/Zend/Application/Module/BootstrapTest.php @@ -77,7 +77,7 @@ public function tearDown() public function testConstructorShouldInitializeModuleResourceLoaderWithModulePrefix() { - $bootstrap = new \ZfModule_Bootstrap($this->application); + $bootstrap = new \ZfModule\Bootstrap($this->application); $module = $bootstrap->getModuleName(); $loader = $bootstrap->getResourceLoader(); $this->assertNotNull($loader, "resource loader is unexpectedly NULL"); @@ -92,13 +92,13 @@ public function testConstructorShouldAcceptResourceLoaderInOptions() )); $this->application->setOptions(array('resourceLoader' => $loader)); - $bootstrap = new \ZfModule_Bootstrap($this->application); + $bootstrap = new \ZfModule\Bootstrap($this->application); $this->assertSame($loader, $bootstrap->getResourceLoader(), var_export($bootstrap->getOptions(), 1)); } public function testModuleNameShouldBeFirstSegmentOfClassName() { - $bootstrap = new \ZfModule_Bootstrap($this->application); + $bootstrap = new \ZfModule\Bootstrap($this->application); $this->assertEquals('ZfModule', $bootstrap->getModuleName()); } @@ -111,7 +111,7 @@ public function testShouldPullModuleNamespacedOptionsWhenPresent() ) ); $this->application->setOptions($options); - $bootstrap = new \ZfModule_Bootstrap($this->application); + $bootstrap = new \ZfModule\Bootstrap($this->application); $this->assertEquals('baz', $bootstrap->foo); } @@ -120,7 +120,7 @@ public function testShouldPullModuleNamespacedOptionsWhenPresent() */ public function testFrontControllerPluginResourceShouldBeRegistered() { - $bootstrap = new \ZfModule_Bootstrap($this->application); + $bootstrap = new \ZfModule\Bootstrap($this->application); $this->assertTrue($bootstrap->hasPluginResource('FrontController')); } @@ -149,12 +149,12 @@ public function testFrontControllerStateRemainsSameIfNoOptionsPassedToModuleBoot $appBootstrap = $this->application->getBootstrap(); $appBootstrap->bootstrap('FrontController'); $front = $appBootstrap->getResource('FrontController'); - $bootstrap = new \ZfModule_Bootstrap($appBootstrap); + $bootstrap = new \ZfModule\Bootstrap($appBootstrap); $bootstrap->bootstrap('FrontController'); $test = $bootstrap->getResource('FrontController'); $this->assertSame($front, $test); $this->assertEquals('/foo', $test->getBaseUrl()); - $this->assertEquals(__DIR__, $test->getControllerDirectory('default')); + $this->assertEquals(__DIR__, $test->getControllerDirectory('application')); } /** @@ -179,7 +179,7 @@ public function testModuleBootstrapsShouldNotAcceptModuleResourceInOrderToPreven $appBootstrap->bootstrap('Modules'); $modules = $appBootstrap->getResource('Modules'); foreach ($modules as $module => $bootstrap) { - if ($module == 'default') { + if ($module == 'application') { // "default" module gets lumped in, and is not a Module_Bootstrap continue; } diff --git a/tests/Zend/Application/Resource/FrontcontrollerTest.php b/tests/Zend/Application/Resource/FrontcontrollerTest.php index 361aa96cbb2..84b45e7f12d 100644 --- a/tests/Zend/Application/Resource/FrontcontrollerTest.php +++ b/tests/Zend/Application/Resource/FrontcontrollerTest.php @@ -96,7 +96,7 @@ public function testShouldSetControllerDirectoryWhenStringOptionPresent() )); $resource->init(); $front = $resource->getFrontController(); - $dir = $front->getControllerDirectory('default'); + $dir = $front->getControllerDirectory('application'); $this->assertEquals(__DIR__, $dir); } @@ -157,9 +157,9 @@ public function testShouldSetModuleDirectoryWhenOptionPresent() 'bar' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'TestAsset' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'bar' . DIRECTORY_SEPARATOR . 'controllers', - 'default' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR + 'application' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'TestAsset' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR - . 'default' . DIRECTORY_SEPARATOR . 'controllers', + . 'application' . DIRECTORY_SEPARATOR . 'controllers', 'foo-bar' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'TestAsset' . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'foo-bar' . DIRECTORY_SEPARATOR . 'controllers', diff --git a/tests/Zend/Application/Resource/ModulesTest.php b/tests/Zend/Application/Resource/ModulesTest.php index dedb5d67b21..19ba4d609d6 100644 --- a/tests/Zend/Application/Resource/ModulesTest.php +++ b/tests/Zend/Application/Resource/ModulesTest.php @@ -36,7 +36,7 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Application */ -class ModulesResourceTest extends \PHPUnit_Framework_TestCase +class ModulesTest extends \PHPUnit_Framework_TestCase { public function setUp() { @@ -133,7 +133,7 @@ public function testInitializationShouldSkipModulesWithoutBootstraps() $this->assertArrayHasKey('bar', (array)$bootstraps); $this->assertArrayHasKey('foo-bar', (array)$bootstraps); $this->assertArrayHasKey('foo', (array)$bootstraps); - $this->assertArrayHasKey('default', (array)$bootstraps); + $this->assertArrayHasKey('application', (array)$bootstraps); } /** @@ -153,6 +153,6 @@ public function testShouldReturnExecutedBootstrapsWhenComplete() $this->assertArrayHasKey('bar', (array)$bootstraps); $this->assertArrayHasKey('foo-bar', (array)$bootstraps); $this->assertArrayHasKey('foo', (array)$bootstraps); - $this->assertArrayHasKey('default', (array)$bootstraps); + $this->assertArrayHasKey('application', (array)$bootstraps); } } diff --git a/tests/Zend/Application/TestAsset/ZfModuleBootstrap.php b/tests/Zend/Application/TestAsset/ZfModuleBootstrap.php index 497aa702055..99dbf7069e8 100644 --- a/tests/Zend/Application/TestAsset/ZfModuleBootstrap.php +++ b/tests/Zend/Application/TestAsset/ZfModuleBootstrap.php @@ -20,6 +20,7 @@ * @version $Id$ */ +namespace ZfModule; use Zend\Application\Module\Bootstrap as ModuleBootstrap; /** @@ -29,7 +30,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class ZfModule_Bootstrap extends ModuleBootstrap +class Bootstrap extends ModuleBootstrap { public function run() { diff --git a/tests/Zend/Application/TestAsset/modules/default/Bootstrap.php b/tests/Zend/Application/TestAsset/modules/application/Bootstrap.php similarity index 100% rename from tests/Zend/Application/TestAsset/modules/default/Bootstrap.php rename to tests/Zend/Application/TestAsset/modules/application/Bootstrap.php diff --git a/tests/Zend/Application/TestAsset/modules/default/controllers/ErrorController.php b/tests/Zend/Application/TestAsset/modules/application/controllers/ErrorController.php similarity index 100% rename from tests/Zend/Application/TestAsset/modules/default/controllers/ErrorController.php rename to tests/Zend/Application/TestAsset/modules/application/controllers/ErrorController.php diff --git a/tests/Zend/Application/TestAsset/modules/bar/Bootstrap.php b/tests/Zend/Application/TestAsset/modules/bar/Bootstrap.php index 3143a6ab6a4..cf55dc58ee9 100644 --- a/tests/Zend/Application/TestAsset/modules/bar/Bootstrap.php +++ b/tests/Zend/Application/TestAsset/modules/bar/Bootstrap.php @@ -20,6 +20,7 @@ * @version $Id$ */ +namespace Bar; use Zend\Application\Module\Bootstrap as ModuleBootstrap; /** @@ -29,7 +30,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Bar_Bootstrap extends ModuleBootstrap +class Bootstrap extends ModuleBootstrap { public $bootstrapped = false; diff --git a/tests/Zend/Application/TestAsset/modules/foo-bar/Bootstrap.php b/tests/Zend/Application/TestAsset/modules/foo-bar/Bootstrap.php index 901e02b7645..f39c71cf4f3 100644 --- a/tests/Zend/Application/TestAsset/modules/foo-bar/Bootstrap.php +++ b/tests/Zend/Application/TestAsset/modules/foo-bar/Bootstrap.php @@ -20,6 +20,8 @@ * @version $Id$ */ +namespace FooBar; + use Zend\Application\Module\Bootstrap as ModuleBootstrap; /** @@ -29,7 +31,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class FooBar_Bootstrap extends ModuleBootstrap +class Bootstrap extends ModuleBootstrap { public $bootstrapped = false; diff --git a/tests/Zend/Application/TestAsset/modules/foo/Bootstrap.php b/tests/Zend/Application/TestAsset/modules/foo/Bootstrap.php index 2c37644d362..579f8a78f83 100644 --- a/tests/Zend/Application/TestAsset/modules/foo/Bootstrap.php +++ b/tests/Zend/Application/TestAsset/modules/foo/Bootstrap.php @@ -20,6 +20,7 @@ * @version $Id$ */ +namespace Foo; use Zend\Application\Module\Bootstrap as ModuleBootstrap; /** @@ -29,7 +30,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Foo_Bootstrap extends ModuleBootstrap +class Bootstrap extends ModuleBootstrap { public $bootstrapped = false; diff --git a/tests/Zend/Application/TestAsset/modules/zfappbootstrap/controllers/IndexController.php b/tests/Zend/Application/TestAsset/modules/zfappbootstrap/controllers/IndexController.php index 3d9643dbe61..b9505e9bce8 100644 --- a/tests/Zend/Application/TestAsset/modules/zfappbootstrap/controllers/IndexController.php +++ b/tests/Zend/Application/TestAsset/modules/zfappbootstrap/controllers/IndexController.php @@ -20,6 +20,7 @@ * @version $Id$ */ +namespace Zfappbootstrap; use Zend\Controller\Action as ActionController; /** @@ -29,7 +30,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Zfappbootstrap_IndexController extends ActionController +class IndexController extends ActionController { public function indexAction() { diff --git a/tests/Zend/Controller/Action/Helper/RedirectorTest.php b/tests/Zend/Controller/Action/Helper/RedirectorTest.php index fba1a72559c..2da32dbe96a 100644 --- a/tests/Zend/Controller/Action/Helper/RedirectorTest.php +++ b/tests/Zend/Controller/Action/Helper/RedirectorTest.php @@ -237,7 +237,7 @@ public function testSetGotoWithActionControllerModuleAndParams() public function testGotoDoesNotUtilizeDefaultSegments() { $request = $this->request; - $request->setModuleName('default'); + $request->setModuleName('application'); $this->redirector->setGoto('index', 'index'); $this->assertEquals('/', $this->redirector->getRedirectUrl()); @@ -451,7 +451,7 @@ public function testPassingDefaultModuleShouldNotRenderModuleNameInRedirectUrl() $this->request->setModuleName('admin') ->setControllerName('class') ->setActionName('view'); - $this->redirector->gotoSimple('login', 'account', 'default'); + $this->redirector->gotoSimple('login', 'account', 'application'); $test = $this->redirector->getRedirectUrl(); $this->assertEquals('/account/login', $test, $test); } diff --git a/tests/Zend/Controller/Action/Helper/UrlTest.php b/tests/Zend/Controller/Action/Helper/UrlTest.php index 902d15839b4..019984aaa91 100644 --- a/tests/Zend/Controller/Action/Helper/UrlTest.php +++ b/tests/Zend/Controller/Action/Helper/UrlTest.php @@ -87,7 +87,7 @@ public function testSimpleWithMissingControllerAndModuleProducesAppropriateURL() public function testSimpleWithDefaultModuleProducesURLWithoutModuleSegment() { - $url = $this->helper->simple('baz', 'bar', 'default', array('bat' => 'foo', 'ho' => 'hum')); + $url = $this->helper->simple('baz', 'bar', 'application', array('bat' => 'foo', 'ho' => 'hum')); $this->assertEquals('/bar/baz', substr($url, 0, 8)); } diff --git a/tests/Zend/Controller/Action/Helper/ViewRendererTest.php b/tests/Zend/Controller/Action/Helper/ViewRendererTest.php index e4c6c5026bf..77d7abe6c30 100644 --- a/tests/Zend/Controller/Action/Helper/ViewRendererTest.php +++ b/tests/Zend/Controller/Action/Helper/ViewRendererTest.php @@ -188,7 +188,7 @@ public function testInitViewWithDefaults() $this->request->setModuleName('foo') ->setControllerName('index'); - $controller = new \Foo_IndexController($this->request, $this->response, array()); + $controller = new \Foo\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $this->helper->initView(); $this->_checkDefaults(); @@ -198,7 +198,7 @@ public function testInitViewWillNotRegisterSameViewPathTwice() { $this->request->setModuleName('foo') ->setControllerName('index'); - $controller = new \Foo_IndexController($this->request, $this->response, array()); + $controller = new \Foo\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $this->helper->initView(); @@ -212,7 +212,7 @@ public function testInitViewCanBeCalledAfterPostDispatch() { $this->request->setModuleName('foo') ->setControllerName('index'); - $controller = new \Foo_IndexController($this->request, $this->response, array()); + $controller = new \Foo\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $this->helper->initView(); @@ -220,7 +220,7 @@ public function testInitViewCanBeCalledAfterPostDispatch() $this->helper->postDispatch(); $this->request->setModuleName('bar') ->setControllerName('index'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $this->helper->initView(); $this->_checkDefaults('bar', 2); @@ -230,7 +230,7 @@ public function testPreDispatchWithDefaults() { $this->request->setModuleName('foo') ->setControllerName('index'); - $controller = new \Foo_IndexController($this->request, $this->response, array()); + $controller = new \Foo\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $this->helper->preDispatch(); @@ -241,7 +241,7 @@ public function testInitViewWithOptions() { $this->request->setModuleName('foo') ->setControllerName('index'); - $controller = new \Foo_IndexController($this->request, $this->response, array()); + $controller = new \Foo\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $viewDir = __DIR__ . str_repeat(DIRECTORY_SEPARATOR . '..', 2) . DIRECTORY_SEPARATOR . 'views'; @@ -305,7 +305,7 @@ public function testNeverRenderFlagDisablesRendering() ->setControllerName('index') ->setActionName('test') ->setDispatched(true); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $this->helper->postDispatch(); @@ -383,7 +383,7 @@ public function testPostDispatchRendersAppropriateScript() ->setControllerName('index') ->setActionName('test') ->setDispatched(true); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $this->helper->postDispatch(); @@ -397,7 +397,7 @@ public function testPostDispatchDoesNothingOnForward() ->setControllerName('index') ->setActionName('test') ->setDispatched(false); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $this->helper->postDispatch(); @@ -413,7 +413,7 @@ public function testPostDispatchDoesNothingOnRedirect() ->setActionName('test') ->setDispatched(true); $this->response->setHttpResponseCode(302); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $this->helper->postDispatch(); @@ -493,7 +493,7 @@ public function testGetViewScriptWithDefaults() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $expected = 'index/test.phtml'; $this->assertEquals($expected, $this->helper->getViewScript()); } @@ -503,7 +503,7 @@ public function testGetViewScriptWithSpecifiedAction() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $expected = 'index/baz.phtml'; $this->assertEquals($expected, $this->helper->getViewScript('baz')); } @@ -513,7 +513,7 @@ public function testGetViewScriptWithSpecifiedVars() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $expected = 'baz/bat.php'; $this->assertEquals( $expected, @@ -529,7 +529,7 @@ public function testGetViewScriptWithNoControllerSet() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->setNoController(); $expected = 'test.phtml'; $this->assertEquals($expected, $this->helper->getViewScript()); @@ -540,7 +540,7 @@ public function testRenderScript() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->renderScript('index/test.phtml'); $body = $this->response->getBody(); $this->assertContains('Rendered index/test.phtml in bar module', $body); @@ -551,7 +551,7 @@ public function testRenderScriptToNamedResponseSegment() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->renderScript('index/test.phtml', 'foo'); $body = $this->response->getBody('foo'); $this->assertContains('Rendered index/test.phtml in bar module', $body); @@ -562,7 +562,7 @@ public function testRenderScriptToPreviouslyNamedResponseSegment() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->setResponseSegment('foo'); $this->helper->renderScript('index/test.phtml'); $body = $this->response->getBody('foo'); @@ -574,7 +574,7 @@ public function testRenderWithDefaults() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->render(); $body = $this->response->getBody(); $this->assertContains('Rendered index/test.phtml in bar module', $body); @@ -585,7 +585,7 @@ public function testRenderToSpecifiedAction() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('index'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->render('test'); $body = $this->response->getBody(); $this->assertContains('Rendered index/test.phtml in bar module', $body); @@ -596,7 +596,7 @@ public function testRenderWithNoController() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->render(null, null, true); $body = $this->response->getBody(); $this->assertContains('Rendered test.phtml in bar module', $body); @@ -607,7 +607,7 @@ public function testRenderToNamedSegment() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->render(null, 'foo'); $body = $this->response->getBody('foo'); $this->assertContains('Rendered index/test.phtml in bar module', $body); @@ -618,7 +618,7 @@ public function testRenderBySpec() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('index'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->renderBySpec('foo', array('controller' => 'test', 'suffix' => 'php')); $body = $this->response->getBody(); $this->assertContains('Rendered test/foo.php', $body); @@ -629,7 +629,7 @@ public function testRenderBySpecToNamedResponseSegment() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('index'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->renderBySpec('foo', array('controller' => 'test', 'suffix' => 'php'), 'foo'); $body = $this->response->getBody('foo'); $this->assertContains('Rendered test/foo.php', $body); @@ -641,7 +641,7 @@ public function testInitDoesNotInitViewWhenNoViewRendererSet() ->setControllerName('index') ->setActionName('index'); $this->front->setParam('noViewRenderer', true); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->assertNull($controller->view); } @@ -651,7 +651,7 @@ public function testPostDispatchDoesNotRenderViewWhenNoViewRendererSet() ->setControllerName('index') ->setActionName('index'); $this->front->setParam('noViewRenderer', true); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->postDispatch(); $body = $this->response->getBody(); $this->assertTrue(empty($body)); @@ -659,21 +659,21 @@ public function testPostDispatchDoesNotRenderViewWhenNoViewRendererSet() public function testRenderNormalizationIsCorrect() { - $this->request->setModuleName('default') + $this->request->setModuleName('application') ->setControllerName('foo') ->setActionName('myBar'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $scriptName = $this->helper->getViewScript(); $this->assertEquals('foo/my-bar.phtml', $scriptName); - $this->request->setModuleName('default') + $this->request->setModuleName('application') ->setControllerName('foo') ->setActionName('baz__bat'); $scriptName = $this->helper->getViewScript(); $this->assertEquals('foo/baz-bat.phtml', $scriptName); - $this->request->setModuleName('default') + $this->request->setModuleName('application') ->setControllerName('Foo_Bar') ->setActionName('bar__baz'); $scriptName = $this->helper->getViewScript(); @@ -708,7 +708,7 @@ public function testCustomInflectorCanUseItsOwnTarget() $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('index'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->view->addBasePath($this->basePath . '/_files/modules/bar/views'); @@ -726,7 +726,7 @@ public function testCustomInflectorUsesViewRendererTargetWhenPassedInWithReferen $this->request->setModuleName('bar') ->setControllerName('index') ->setActionName('test'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->view->addBasePath($this->basePath . '/_files/modules/bar/views'); @@ -764,7 +764,7 @@ public function testStockInflectorWorksWithViewBaseSpec() $this->request->setModuleName('bar') // bar must exist so the ViewRendere doesnt throw an exception ->setControllerName('index') ->setActionName('admin'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $this->helper->setViewBasePathSpec(':moduleDir/:module'); @@ -788,7 +788,7 @@ public function testStockInflectorWorksWithDottedRequestParts() $this->request->setModuleName('foo') ->setControllerName('car.bar') ->setActionName('baz'); - $controller = new \Bar_IndexController($this->request, $this->response, array()); + $controller = new \Bar\IndexController($this->request, $this->response, array()); $this->helper->setActionController($controller); $viewScriptPaths = $this->helper->view->getAllPaths(); @@ -806,7 +806,7 @@ public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvo $this->request->setModuleName('foo') ->setControllerName('admin_index') ->setActionName('use-helper'); - $controller = new \Foo_Admin_IndexController($this->request, $this->response, array()); + $controller = new \Foo\Admin\IndexController($this->request, $this->response, array()); $this->helper->render(); $body = $this->response->getBody(); @@ -815,10 +815,10 @@ public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvo public function testCorrectViewHelperPathShouldBePropagatedWhenSubControllerInvokedInDefaultModule() { - require_once $this->basePath . '/_files/modules/default/controllers/Admin/HelperController.php'; + require_once $this->basePath . '/_files/modules/application/controllers/Admin/HelperController.php'; $this->request->setControllerName('admin_helper') ->setActionName('render'); - $controller = new \Admin_HelperController($this->request, $this->response, array()); + $controller = new \Admin\HelperController($this->request, $this->response, array()); $this->helper->render(); $body = $this->response->getBody(); diff --git a/tests/Zend/Controller/Dispatcher/StandardTest.php b/tests/Zend/Controller/Dispatcher/StandardTest.php index 71baf3be502..e307ef5a42b 100644 --- a/tests/Zend/Controller/Dispatcher/StandardTest.php +++ b/tests/Zend/Controller/Dispatcher/StandardTest.php @@ -52,7 +52,7 @@ public function setUp() \Zend\Controller\Action\HelperBroker::removeHelper('viewRenderer'); $this->_dispatcher = new \Zend\Controller\Dispatcher\Standard(); $this->_dispatcher->setControllerDirectory(array( - 'default' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files', + 'application' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files', 'admin' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Admin' )); } @@ -65,7 +65,7 @@ public function tearDown() public function testFormatControllerName() { $this->assertEquals('IndexController', $this->_dispatcher->formatControllerName('index')); - $this->assertEquals('Site_CustomController', $this->_dispatcher->formatControllerName('site_custom')); + $this->assertEquals('Site\CustomController', $this->_dispatcher->formatControllerName('site\custom')); } public function testFormatActionName() @@ -80,7 +80,7 @@ public function testFormatActionName() public function testSetGetControllerDirectory() { $expected = array( - 'default' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files', + 'application' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files', 'admin' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Admin' ); $dirs = $this->_dispatcher->getControllerDirectory(); @@ -125,6 +125,7 @@ public function testModuleIsDispatchable() public function testIsDispatchableManuallyIncludedController() { require_once __DIR__ . '/../_files/ManuallyIncludedControllers.php'; + require_once __DIR__ . '/../_files/ManuallyIncludedControllersNamespaced.php'; $request = new \Zend\Controller\Request\Http(); @@ -260,14 +261,14 @@ public function testDispatchInvalidControllerUsingDefaultsWithDefaultModule() { $request = new Request\Http(); $request->setControllerName('bogus') - ->setModuleName('default'); + ->setModuleName('application'); $response = new Response\Cli(); $this->_dispatcher->setParam('useDefaultControllerAlways', true); try { $this->_dispatcher->dispatch($request, $response); - $this->assertSame('default', $request->getModuleName()); + $this->assertSame('application', $request->getModuleName()); $this->assertSame('index', $request->getControllerName()); $this->assertSame('index', $request->getActionName()); } catch (\Exception $e) { @@ -317,7 +318,7 @@ public function testWordDelimiter() public function testPathDelimiter() { - $this->assertEquals('_', $this->_dispatcher->getPathDelimiter()); + $this->assertEquals('\\', $this->_dispatcher->getPathDelimiter()); $this->_dispatcher->setPathDelimiter(':'); $this->assertEquals(':', $this->_dispatcher->getPathDelimiter()); } @@ -427,7 +428,7 @@ public function testModuleSubdirControllerFound() $request = new Request\Http(); $request->setModuleName('foo'); - $request->setControllerName('admin_index'); + $request->setControllerName('admin\index'); $request->setActionName('index'); $this->assertTrue($this->_dispatcher->isDispatchable($request), var_export($this->_dispatcher->getControllerDirectory(), 1)); @@ -440,14 +441,14 @@ public function testModuleSubdirControllerFound() public function testDefaultModule() { - $this->assertEquals('default', $this->_dispatcher->getDefaultModule()); + $this->assertEquals('application', $this->_dispatcher->getDefaultModule()); $this->_dispatcher->setDefaultModule('foobar'); $this->assertEquals('foobar', $this->_dispatcher->getDefaultModule()); } public function testModuleValid() { - $this->assertTrue($this->_dispatcher->isValidModule('default')); + $this->assertTrue($this->_dispatcher->isValidModule('application')); $this->assertTrue($this->_dispatcher->isValidModule('admin')); $this->assertFalse($this->_dispatcher->isValidModule('bogus')); $this->assertFalse($this->_dispatcher->isValidModule(null)); @@ -516,7 +517,7 @@ public function testLoadClassLoadsControllerInSpecifiedModuleWithModulePrefix() $class = $this->_dispatcher->getControllerClass($request); $this->assertEquals('IndexController', $class); $test = $this->_dispatcher->loadClass($class); - $this->assertEquals('Bar_IndexController', $test); + $this->assertEquals('Bar\IndexController', $test); $this->assertTrue(class_exists($test)); } @@ -532,7 +533,7 @@ public function testLoadClassLoadsControllerInDefaultModuleWithModulePrefixWhenR $class = $this->_dispatcher->getControllerClass($request); $this->assertEquals('IndexController', $class); $test = $this->_dispatcher->loadClass($class); - $this->assertEquals('Foo_IndexController', $test); + $this->assertEquals('Foo\IndexController', $test); $this->assertTrue(class_exists($test)); } diff --git a/tests/Zend/Controller/FrontTest.php b/tests/Zend/Controller/FrontTest.php index fa1f58e2dce..dc46fead4f2 100644 --- a/tests/Zend/Controller/FrontTest.php +++ b/tests/Zend/Controller/FrontTest.php @@ -168,7 +168,7 @@ public function testSetGetDispatcher() public function testSetGetControllerDirectory() { $test = $this->_controller->getControllerDirectory(); - $expected = array('default' => __DIR__ . DIRECTORY_SEPARATOR . '_files'); + $expected = array('application' => __DIR__ . DIRECTORY_SEPARATOR . '_files'); $this->assertSame($expected, $test); } @@ -530,12 +530,12 @@ public function testAddModuleDirectory() $controllerDirs = $this->_controller->getControllerDirectory(); $this->assertTrue(isset($controllerDirs['foo'])); $this->assertTrue(isset($controllerDirs['bar'])); - $this->assertTrue(isset($controllerDirs['default'])); + $this->assertTrue(isset($controllerDirs['application'])); $this->assertFalse(isset($controllerDirs['.svn'])); $this->assertContains('modules' . DIRECTORY_SEPARATOR . 'foo', $controllerDirs['foo']); $this->assertContains('modules' . DIRECTORY_SEPARATOR . 'bar', $controllerDirs['bar']); - $this->assertContains('modules' . DIRECTORY_SEPARATOR . 'default', $controllerDirs['default']); + $this->assertContains('modules' . DIRECTORY_SEPARATOR . 'application', $controllerDirs['application']); } /**#@+ diff --git a/tests/Zend/Controller/Plugin/ErrorHandlerTest.php b/tests/Zend/Controller/Plugin/ErrorHandlerTest.php index 12c44e90b65..c909f79c351 100644 --- a/tests/Zend/Controller/Plugin/ErrorHandlerTest.php +++ b/tests/Zend/Controller/Plugin/ErrorHandlerTest.php @@ -135,7 +135,7 @@ public function testPostDispatchNoControllerException() $this->assertEquals('error', $this->request->getActionName()); $this->assertEquals('error', $this->request->getControllerName()); - $this->assertEquals('default', $this->request->getModuleName()); + $this->assertEquals('application', $this->request->getModuleName()); } public function testPostDispatchNoActionException() @@ -153,7 +153,7 @@ public function testPostDispatchNoActionException() $this->assertEquals('error', $this->request->getActionName()); $this->assertEquals('error', $this->request->getControllerName()); - $this->assertEquals('default', $this->request->getModuleName()); + $this->assertEquals('application', $this->request->getModuleName()); } public function testPostDispatchOtherException() @@ -171,7 +171,7 @@ public function testPostDispatchOtherException() $this->assertEquals('error', $this->request->getActionName()); $this->assertEquals('error', $this->request->getControllerName()); - $this->assertEquals('default', $this->request->getModuleName()); + $this->assertEquals('application', $this->request->getModuleName()); } public function testPostDispatchThrowsWhenCalledRepeatedly() diff --git a/tests/Zend/Controller/Router/RewriteTest.php b/tests/Zend/Controller/Router/RewriteTest.php index a253f57d9f5..176bae440b4 100644 --- a/tests/Zend/Controller/Router/RewriteTest.php +++ b/tests/Zend/Controller/Router/RewriteTest.php @@ -165,7 +165,7 @@ public function testDefaultRoute() $token = $this->_router->route($request); $routes = $this->_router->getRoutes(); - $this->assertType('Zend\Controller\Router\Route\Module', $routes['default']); + $this->assertType('Zend\Controller\Router\Route\Module', $routes['application']); } public function testDefaultRouteWithEmptyAction() @@ -221,7 +221,7 @@ public function testRouteNotMatched() { $request = new Request('http://localhost/archive/action/bogus'); - $this->_router->addRoute('default', new Route\Route(':controller/:action')); + $this->_router->addRoute('application', new Route\Route(':controller/:action')); try { $token = $this->_router->route($request); @@ -294,7 +294,7 @@ public function testGetCurrentRoute() $this->fail('Current route is not set'); } - $this->assertEquals('default', $name); + $this->assertEquals('application', $name); $this->assertType('Zend\Controller\Router\Route\Module', $route); } @@ -374,7 +374,7 @@ public function testRouteCompatDefaults() $token = $this->_router->route($request); - $this->assertEquals('default', $token->getModuleName()); + $this->assertEquals('application', $token->getModuleName()); $this->assertEquals('defctrl', $token->getControllerName()); $this->assertEquals('defact', $token->getActionName()); } @@ -382,7 +382,7 @@ public function testRouteCompatDefaults() public function testDefaultRouteWithEmptyControllerAndAction() { Controller\Front::getInstance()->setControllerDirectory(array( - 'default' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files', + 'application' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files', 'mod' => __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'Admin', )); $request = new Request('http://localhost/mod'); @@ -701,7 +701,7 @@ public function testRequestParamsUsedAsGlobalParam() public function testCanGenerateNumericKeyUri() { $this->_router->addRoute( - 'default', + 'application', new Route\Route( ':controller/:action/*', array('controller' => 'index', 'action' => 'index') diff --git a/tests/Zend/Controller/Router/Route/ChainTest.php b/tests/Zend/Controller/Router/Route/ChainTest.php index 50928d7805b..edb29f99a9e 100644 --- a/tests/Zend/Controller/Router/Route/ChainTest.php +++ b/tests/Zend/Controller/Router/Route/ChainTest.php @@ -400,7 +400,7 @@ public function testConfigChaining() $request = new Request('http://foo.example.com/imprint'); $token = $router->route($request); - $this->assertEquals('default', $token->getModuleName()); + $this->assertEquals('application', $token->getModuleName()); $this->assertEquals('imprint', $token->getControllerName()); $this->assertEquals('defact', $token->getActionName()); } diff --git a/tests/Zend/Controller/_files/Admin/BazController.php b/tests/Zend/Controller/_files/Admin/BazController.php index 87597586dd6..34baa399baf 100644 --- a/tests/Zend/Controller/_files/Admin/BazController.php +++ b/tests/Zend/Controller/_files/Admin/BazController.php @@ -20,6 +20,7 @@ * @version $Id$ */ +namespace Admin; /** * Mock file for testbed @@ -30,7 +31,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Admin_BazController extends \Zend\Controller\Action +class BazController extends \Zend\Controller\Action { /** diff --git a/tests/Zend/Controller/_files/Admin/FooBarController.php b/tests/Zend/Controller/_files/Admin/FooBarController.php index 77c56b3f806..e9f9380583b 100644 --- a/tests/Zend/Controller/_files/Admin/FooBarController.php +++ b/tests/Zend/Controller/_files/Admin/FooBarController.php @@ -20,6 +20,8 @@ * @version $Id$ */ +namespace Admin; + require_once __DIR__ . '/../FooController.php'; /** @@ -31,7 +33,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Admin_FooBarController extends \FooController +class FooBarController extends \FooController { /** diff --git a/tests/Zend/Controller/_files/Admin/FooController.php b/tests/Zend/Controller/_files/Admin/FooController.php index 9f592190c5d..db39686b14e 100644 --- a/tests/Zend/Controller/_files/Admin/FooController.php +++ b/tests/Zend/Controller/_files/Admin/FooController.php @@ -20,6 +20,8 @@ * @version $Id$ */ +namespace Admin; + require_once __DIR__ . '/../FooController.php'; /** @@ -31,7 +33,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Admin_FooController extends \FooController +class FooController extends \FooController { /** diff --git a/tests/Zend/Controller/_files/ManuallyIncludedControllers.php b/tests/Zend/Controller/_files/ManuallyIncludedControllers.php index 5150d5d7cd3..26807f93fbe 100644 --- a/tests/Zend/Controller/_files/ManuallyIncludedControllers.php +++ b/tests/Zend/Controller/_files/ManuallyIncludedControllers.php @@ -1,54 +1,8 @@ assertEquals($expected, $filter($input)); } - /** - * @group ZF-9434 - */ - public function testCommentWithTagInSameLine() - { - $input = 'test test
div-content
'; - $expected = 'test test div-content'; - $this->assertEquals($expected, $this->_filter->filter($input)); - } - /** * @group ZF-9833 */ @@ -617,5 +607,3 @@ public function testMultiQuoteInput() $this->assertEquals($expected, $filter->filter($input)); } } - -} diff --git a/tests/Zend/Log/Filter/PriorityTest.php b/tests/Zend/Log/Filter/PriorityTest.php index 9004986889c..60a3ff5703d 100644 --- a/tests/Zend/Log/Filter/PriorityTest.php +++ b/tests/Zend/Log/Filter/PriorityTest.php @@ -67,7 +67,7 @@ public function testFactory() 'writerName' => "Mock", 'filterName' => "Priority", 'filterParams' => array( - 'priority' => "\\Zend\\Log\\Logger::CRIT", + 'priority' => '\Zend\Log\Logger::CRIT', 'operator' => "<=" ), ))); @@ -78,7 +78,7 @@ public function testFactory() public function testFactoryRaisesExceptionWithInvalidPriority() { - $this->setExpectedException('\\Zend\\Log\\Exception', 'must be an integer'); + $this->setExpectedException('\Zend\Log\Exception', 'must be an integer'); $logger = Logger::factory(array('Null' => array( 'writerName' => 'Mock', 'filterName' => 'Priority', diff --git a/tests/Zend/Log/Writer/DbTest.php b/tests/Zend/Log/Writer/DbTest.php index 00dae122a20..3d2075f41bb 100644 --- a/tests/Zend/Log/Writer/DbTest.php +++ b/tests/Zend/Log/Writer/DbTest.php @@ -118,12 +118,13 @@ public function testFactory() */ public function testThrowStrictSetFormatter() { - try { - $this->writer->setFormatter(new StdClass()); - } catch (Exception $e) { - $this->assertType('PHPUnit_Framework_Error', $e); - $this->assertContains('must implement interface', $e->getMessage()); - } + $this->setExpectedException('PHPUnit_Framework_Error'); +// try { + $this->writer->setFormatter(new \StdClass()); +// } catch (Exception $e) { +// $this->assertType('PHPUnit_Framework_Error', $e); +// $this->assertContains('must implement interface', $e->getMessage()); +// } } } diff --git a/tests/Zend/Log/Writer/ZendMonitorTest.php b/tests/Zend/Log/Writer/ZendMonitorTest.php index 8869107f769..81162242556 100755 --- a/tests/Zend/Log/Writer/ZendMonitorTest.php +++ b/tests/Zend/Log/Writer/ZendMonitorTest.php @@ -20,6 +20,8 @@ * @version $Id$ */ +namespace ZendTest\Log\Writer; + /** PHPUnit_Framework_TestCase */ require_once 'PHPUnit/Framework/TestCase.php'; @@ -34,14 +36,14 @@ * @license http://framework.zend.com/license/new-bsd New BSD License * @group Zend_Log */ -class Zend_Log_Writer_ZendMonitorTest extends PHPUnit_Framework_TestCase +class ZendMonitorTest extends \PHPUnit_Framework_TestCase { /** * @group ZF-10081 */ public function testWrite() { - $writer = new Zend_Log_Writer_ZendMonitor(); + $writer = new \Zend\Log\Writer\ZendMonitor(); $writer->write(array('message' => 'my mess', 'priority' => 1)); } @@ -49,13 +51,13 @@ public function testFactory() { $cfg = array(); - $writer = Zend_Log_Writer_ZendMonitor::factory($cfg); - $this->assertTrue($writer instanceof Zend_Log_Writer_ZendMonitor); + $writer = \Zend\Log\Writer\ZendMonitor::factory($cfg); + $this->assertTrue($writer instanceof \Zend\Log\Writer\ZendMonitor); } public function testIsEnabled() { - $writer = new Zend_Log_Writer_ZendMonitor(); + $writer = new \Zend\Log\Writer\ZendMonitor(); $this->assertType('boolean', $writer->isEnabled()); } } diff --git a/tests/Zend/Paginator/_files/test.sqlite b/tests/Zend/Paginator/_files/test.sqlite index 1abb8d91302c0f066b0515b9ab65c6912f95721c..5eebdfce04ce0414e9acc8a8b73d75bc155428ea 100644 GIT binary patch delta 49 ucmZn&Xb6}fE%=rJ1u)fZ)KO$&view->setScriptPath(__DIR__ . '/_files/modules/default/views/scripts/'); + $this->view->setScriptPath(__DIR__ . '/_files/modules/application/views/scripts/'); $partial->setView($this->view); HelperBroker::getStaticHelper('viewRenderer')->view = $this->view; diff --git a/tests/Zend/View/Helper/Navigation/BreadcrumbsTest.php b/tests/Zend/View/Helper/Navigation/BreadcrumbsTest.php index becc83f0d5a..8864eadbc99 100644 --- a/tests/Zend/View/Helper/Navigation/BreadcrumbsTest.php +++ b/tests/Zend/View/Helper/Navigation/BreadcrumbsTest.php @@ -221,7 +221,7 @@ public function testRenderingPartial() public function testRenderingPartialBySpecifyingAnArrayAsPartial() { - $this->_helper->setPartial(array('bc.phtml', 'default')); + $this->_helper->setPartial(array('bc.phtml', 'application')); $expected = $this->_getExpected('bc/partial.html'); $this->assertEquals($expected, $this->_helper->render()); diff --git a/tests/Zend/View/Helper/Navigation/MenuTest.php b/tests/Zend/View/Helper/Navigation/MenuTest.php index 8ba0f76f7a6..672071a2b37 100644 --- a/tests/Zend/View/Helper/Navigation/MenuTest.php +++ b/tests/Zend/View/Helper/Navigation/MenuTest.php @@ -251,7 +251,7 @@ public function testRenderingPartial() public function testRenderingPartialBySpecifyingAnArrayAsPartial() { - $this->_helper->setPartial(array('menu.phtml', 'default')); + $this->_helper->setPartial(array('menu.phtml', 'application')); $expected = $this->_getExpected('menu/partial.html'); $actual = $this->_helper->render(); diff --git a/tests/Zend/View/Helper/PartialLoopTest.php b/tests/Zend/View/Helper/PartialLoopTest.php index 8db046f1f54..a9c20c8e874 100644 --- a/tests/Zend/View/Helper/PartialLoopTest.php +++ b/tests/Zend/View/Helper/PartialLoopTest.php @@ -87,7 +87,7 @@ public function testPartialLoopIteratesOverArray() ); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); @@ -112,7 +112,7 @@ public function testPartialLoopIteratesOverIterator() $o = new IteratorTest($data); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); @@ -137,7 +137,7 @@ public function testPartialLoopIteratesOverRecursiveIterator() } $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); @@ -163,7 +163,7 @@ public function testPartialLoopThrowsExceptionWithBadIterator() $o = new BogusIteratorTest($data); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); @@ -188,7 +188,7 @@ public function testPartialLoopFindsModule() ); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); @@ -216,7 +216,7 @@ public function testShouldAllowIteratingOverTraversableObjects() $o = new \ArrayObject($data); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); @@ -238,7 +238,7 @@ public function testShouldAllowIteratingOverObjectsImplementingToArray() $o = new ToArrayTest($data); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); @@ -264,7 +264,7 @@ public function testShouldNotCastToArrayIfObjectIsTraversable() $o = new IteratorWithToArrayTest($data); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); $this->helper->setObjectKey('obj'); @@ -282,7 +282,7 @@ public function testShouldNotCastToArrayIfObjectIsTraversable() public function testEmptyArrayPassedToPartialLoopShouldNotThrowException() { $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); @@ -313,7 +313,7 @@ public function testPartialLoopIncramentsPartialCounter() ); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); @@ -338,7 +338,7 @@ public function testPartialLoopPartialCounterResets() ); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); diff --git a/tests/Zend/View/Helper/PartialTest.php b/tests/Zend/View/Helper/PartialTest.php index f939555778f..52bfc47959d 100644 --- a/tests/Zend/View/Helper/PartialTest.php +++ b/tests/Zend/View/Helper/PartialTest.php @@ -81,7 +81,7 @@ public function tearDown() public function testPartialRendersScript() { $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); $return = $this->helper->direct('partialOne.phtml'); @@ -94,7 +94,7 @@ public function testPartialRendersScript() public function testPartialRendersScriptWithVars() { $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $view->message = 'This should never be read'; $this->helper->setView($view); @@ -110,7 +110,7 @@ public function testPartialRendersScriptInDifferentModuleWhenRequested() { Controller\Front::getInstance()->addModuleDirectory($this->basePath); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); $return = $this->helper->direct('partialTwo.phtml', 'foo'); @@ -124,7 +124,7 @@ public function testPartialThrowsExceptionWithInvalidModule() { Controller\Front::getInstance()->addModuleDirectory($this->basePath); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); @@ -180,7 +180,7 @@ public function testObjectModelWithPublicPropertiesSetsViewVariables() $model->bar = 'baz'; $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); $return = $this->helper->direct('partialVars.phtml', $model); @@ -196,7 +196,7 @@ public function testObjectModelWithToArraySetsViewVariables() $model = new Aggregate(); $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); $return = $this->helper->direct('partialVars.phtml', $model); @@ -215,7 +215,7 @@ public function testObjectModelSetInObjectKeyWhenKeyPresent() $model->bartest = 'baz'; $view = new View\View(array( - 'scriptPath' => $this->basePath . '/default/views/scripts' + 'scriptPath' => $this->basePath . '/application/views/scripts' )); $this->helper->setView($view); $return = $this->helper->direct('partialObj.phtml', $model); diff --git a/tests/Zend/View/Helper/_files/modules/default/controllers/ActionBarController.php b/tests/Zend/View/Helper/_files/modules/application/controllers/ActionBarController.php similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/controllers/ActionBarController.php rename to tests/Zend/View/Helper/_files/modules/application/controllers/ActionBarController.php diff --git a/tests/Zend/View/Helper/_files/modules/default/controllers/ActionFooController.php b/tests/Zend/View/Helper/_files/modules/application/controllers/ActionFooController.php similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/controllers/ActionFooController.php rename to tests/Zend/View/Helper/_files/modules/application/controllers/ActionFooController.php diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/action-bar/baz.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/action-bar/baz.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/action-bar/baz.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/action-bar/baz.phtml diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/action-foo/bar.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/action-foo/bar.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/action-foo/bar.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/action-foo/bar.phtml diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/action-foo/baz.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/action-foo/baz.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/action-foo/baz.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/action-foo/baz.phtml diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/partialActionCall.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/partialActionCall.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/partialActionCall.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/partialActionCall.phtml diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/partialLoop.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/partialLoop.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/partialLoop.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/partialLoop.phtml diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/partialLoopCouter.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/partialLoopCouter.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/partialLoopCouter.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/partialLoopCouter.phtml diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/partialLoopObject.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/partialLoopObject.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/partialLoopObject.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/partialLoopObject.phtml diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/partialObj.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/partialObj.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/partialObj.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/partialObj.phtml diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/partialOne.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/partialOne.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/partialOne.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/partialOne.phtml diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/partialThree.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/partialThree.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/partialThree.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/partialThree.phtml diff --git a/tests/Zend/View/Helper/_files/modules/default/views/scripts/partialVars.phtml b/tests/Zend/View/Helper/_files/modules/application/views/scripts/partialVars.phtml similarity index 100% rename from tests/Zend/View/Helper/_files/modules/default/views/scripts/partialVars.phtml rename to tests/Zend/View/Helper/_files/modules/application/views/scripts/partialVars.phtml diff --git a/tests/Zend/View/Helper/_files/modules/foo/controllers/BazController.php b/tests/Zend/View/Helper/_files/modules/foo/controllers/BazController.php index 8e1a2783e9c..69e02b766ae 100644 --- a/tests/Zend/View/Helper/_files/modules/foo/controllers/BazController.php +++ b/tests/Zend/View/Helper/_files/modules/foo/controllers/BazController.php @@ -20,6 +20,8 @@ * @version $Id$ */ +namespace Foo; + /** * @category Zend * @package Zend_View @@ -27,7 +29,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Foo_BazController extends \Zend\Controller\Action +class BazController extends \Zend\Controller\Action { public function barOneAction() diff --git a/tests/Zend/View/Helper/_files/modules/foo/controllers/FooController.php b/tests/Zend/View/Helper/_files/modules/foo/controllers/FooController.php index 7d4a9b14afe..ead11b34f25 100644 --- a/tests/Zend/View/Helper/_files/modules/foo/controllers/FooController.php +++ b/tests/Zend/View/Helper/_files/modules/foo/controllers/FooController.php @@ -20,6 +20,8 @@ * @version $Id$ */ +namespace Foo; + /** * @category Zend * @package Zend_View @@ -27,7 +29,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Foo_FooController extends \Zend\Controller\Action +class FooController extends \Zend\Controller\Action { public function barAction() { From dfff1145947894b20309d8d22f674f75ae2d9ce3 Mon Sep 17 00:00:00 2001 From: Ralph Schindler Date: Tue, 3 Aug 2010 10:56:57 -0500 Subject: [PATCH 05/19] Fix for module creation support in Zend\Tool --- library/Zend/Tool/Project/Provider/Module.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/Zend/Tool/Project/Provider/Module.php b/library/Zend/Tool/Project/Provider/Module.php index b97f318af3c..d098baffea9 100644 --- a/library/Zend/Tool/Project/Provider/Module.php +++ b/library/Zend/Tool/Project/Provider/Module.php @@ -70,7 +70,7 @@ public static function createResources(\Zend\Tool\Project\Profile $profile, $mod $targetModuleResource, array( 'denyNames' => array('ModulesDirectory', 'ViewControllerScriptsDirectory'), - 'denyType' => 'Zend_Tool_Project_Context_Filesystem_File' + 'denyType' => 'Zend\Tool\Project\Context\Filesystem\File' ) ); @@ -81,6 +81,7 @@ public static function createResources(\Zend\Tool\Project\Profile $profile, $mod $currentDepth = 0; $parentResources = array(); $currentResource = $moduleDirectory; + $currentChildResource = null; // loop through the target module skeleton foreach ($targetIterator as $targetSubResource) { From 387abcd4e4f638456b5f4cc50d987780b054bdab Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Mon, 2 Aug 2010 14:48:36 -0400 Subject: [PATCH 06/19] Project providers - Remove "require_once" statements from code generation. --- library/Zend/Tool/Project/Context/Zf/ProjectProviderFile.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/library/Zend/Tool/Project/Context/Zf/ProjectProviderFile.php b/library/Zend/Tool/Project/Context/Zf/ProjectProviderFile.php index a8c170a397f..25a550d54e6 100644 --- a/library/Zend/Tool/Project/Context/Zf/ProjectProviderFile.php +++ b/library/Zend/Tool/Project/Context/Zf/ProjectProviderFile.php @@ -139,10 +139,6 @@ public function getContents() } $codeGenFile = new \Zend\CodeGenerator\Php\PhpFile(array( - 'requiredFiles' => array( - 'Zend/Tool/Project/Provider/Abstract.php', - 'Zend/Tool/Project/Provider/Exception.php' - ), 'classes' => array($class) )); From 4389a4935795fa0600b00d6ecaf970a087a6c75f Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 3 Aug 2010 13:09:40 -0400 Subject: [PATCH 07/19] Session behavior fixes - Return early during offsetExists() calls if a container for the namespace does not exist. - Redirector's redirectAndExit() method was calling session_write_close(), which was preventing the session object's destructor from being called -- and thus not persisting. Removing the call fixes the situation. --- .../Zend/Controller/Action/Helper/Redirector.php | 7 ------- library/Zend/Session/Container.php | 13 ++++++++++--- library/Zend/Session/SessionManager.php | 6 ++++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/library/Zend/Controller/Action/Helper/Redirector.php b/library/Zend/Controller/Action/Helper/Redirector.php index 0db4b75b989..d1438bd9610 100644 --- a/library/Zend/Controller/Action/Helper/Redirector.php +++ b/library/Zend/Controller/Action/Helper/Redirector.php @@ -477,13 +477,6 @@ public function gotoUrlAndExit($url, array $options = array()) */ public function redirectAndExit() { - if ($this->getCloseSessionOnExit()) { - // Close session, if started - if (isset($_SESSION) && !empty($_SESSION)) { - session_write_close(); - } - } - $this->getResponse()->sendHeaders(); exit(); } diff --git a/library/Zend/Session/Container.php b/library/Zend/Session/Container.php index e9f8a5211cc..f66c87514be 100644 --- a/library/Zend/Session/Container.php +++ b/library/Zend/Session/Container.php @@ -184,14 +184,18 @@ protected function _createContainer() * If not, it raises an exception; otherwise, it returns the Storage * object. * - * @return Storage + * @param bool $createContainer Whether or not to create the container for the namespace + * @return Storage|null Returns null only if $createContainer is false * @throws Exception */ - protected function _verifyNamespace() + protected function _verifyNamespace($createContainer = true) { $storage = $this->_getStorage(); $name = $this->getName(); if (!isset($storage[$name])) { + if (!$createContainer) { + return; + } $storage[$name] = $this->_createContainer(); } if (!is_array($storage[$name]) && !$storage[$name] instanceof ArrayObject) { @@ -341,7 +345,10 @@ public function offsetSet($key, $value) */ public function offsetExists($key) { - $storage = $this->_verifyNamespace(); + // If no container exists, we can't inspect it + if (null === ($storage = $this->_verifyNamespace(false))) { + return false; + } $name = $this->getName(); // Return early if the key isn't set diff --git a/library/Zend/Session/SessionManager.php b/library/Zend/Session/SessionManager.php index 6b0a780867d..7d30bde592c 100644 --- a/library/Zend/Session/SessionManager.php +++ b/library/Zend/Session/SessionManager.php @@ -105,8 +105,10 @@ public function start() // Since session is starting, we need to potentially repopulate our // session storage - if ($storage instanceof Storage\SessionStorage) { - $storage->exchangeArray($_SESSION); + if ($storage instanceof Storage\SessionStorage + && $_SESSION !== $storage + ) { + $storage->fromArray($_SESSION); $_SESSION = $storage; } } From 73d8183b4d3b584569969edbccb47f673fdf103a Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 3 Aug 2010 14:09:08 -0400 Subject: [PATCH 08/19] README updates - Minor changes, corrections, and additions to README in preparation for a development milestone release. --- INSTALL.txt | 74 ++++++++++++++++++++++++++------------------------ README-DEV.txt | 5 ++++ README.txt | 15 ++++++++++ 3 files changed, 59 insertions(+), 35 deletions(-) diff --git a/INSTALL.txt b/INSTALL.txt index 5f6eecde660..5600ad610f6 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -1,68 +1,72 @@ INSTALLATION ------------ -Zend Framework requires no special installation steps. Simply download the framework, -extract it to the folder you would like to keep it in, and add the library directory -to your PHP include_path. To use components in the extras library, add the extras/library -directory to your PHP include_path, as well. -If you would like to use Zend_Tool, simply add bin/zf.bat (for Windows) or -bin/zf.sh (for anything else) to your system executable path. +Zend Framework requires no special installation steps. Simply download +the framework, extract it to the folder you would like to keep it in, +and add the library directory to your PHP include_path. To use +components in the extras library, add the extras/library directory to +your PHP include_path as well. + +If you would like to use Zend_Tool, simply add "bin/zf.bat" (for Windows) +or "bin/zf.sh" (for anything else) to your system executable path. SYSTEM REQUIREMENTS ------------------- -Zend Framework requires PHP 5.2.4 or later. Please see the system requirements -appendix for more detailed information: +Zend Framework 2 requires PHP 5.3.1 or later. -http://framework.zend.com/manual/en/requirements.html DEVELOPMENT VERSIONS -------------------- -If you would like to preview enhancements or bug fixes that have not yet been -released, you can obtain the current development version of Zend Framework using one -of the following methods: +If you would like to preview enhancements or bug fixes that have not yet +been released, you can obtain the current development version of Zend +Framework using one of the following methods: -* Using a Git client. Zend Framework is open source software, and the Git - repository used for its development is publicly available. Consider using Git - to get Zend Framework if you already use Git for your application development, - want to contribute back to the framework, or need to upgrade your framework - version very often. +* Using a Git client. Zend Framework is open source software, and the + Git repository used for its development is publicly available. + Consider using Git to get Zend Framework if you already use Git for + your application development, want to contribute back to the + framework, or need to upgrade your framework version very often. - Checking out a working copy is necessary if you would like to directly contribute - to Zend Framework; a working copy can be updated any time using git pull. + Checking out a working copy is necessary if you would like to directly + contribute to Zend Framework; a working copy can be updated any time + using git pull. To clone the git repository, use the following URL: - git://git.zendframework.com/zf.git + git://git.zendframework.com/zf.git For more information about Git, please see the official website: - http://www.git-scm.org + http://www.git-scm.org CONFIGURING THE INCLUDE PATH ---------------------------- -Once you have a copy of Zend Framework available, your application will need to -access the framework classes. Though there are several ways to achieve this, your -PHP include_path needs to contain the path to the Zend Framework classes under the -/library directory in this distribution. You can find out more about the PHP -include_path configuration directive here: +Once you have a copy of Zend Framework available, your application will +need to access the framework classes. Though there are several ways to +achieve this, your PHP include_path needs to contain the path to the +Zend Framework classes under the /library directory in this +distribution. You can find out more about the PHP include_path +configuration directive here: -http://www.php.net/manual/en/ini.core.php#ini.include-path + http://www.php.net/manual/en/ini.core.php#ini.include-path -Instructions on how to change PHP configuration directives can be found here: +Instructions on how to change PHP configuration directives can be found +here: -http://www.php.net/manual/en/configuration.changes.php + http://www.php.net/manual/en/configuration.changes.php GETTING STARTED --------------- -A great place to get up-to-speed quickly is the Zend Framework QuickStart: +A great place to get up-to-speed quickly is the Zend Framework +QuickStart: -http://framework.zend.com/manual/en/learning.quickstart.html + http://framework.zend.com/manual/en/learning.quickstart.html -The QuickStart covers some of the most commonly used components of ZF. Since -Zend Framework is designed with a use-at-will architecture and components are -loosely coupled, you can select and use only those components that are needed for -your project. +The QuickStart covers some of the most commonly used components of ZF. +Since Zend Framework is designed with a use-at-will architecture and +components are loosely coupled, you can select and use only those +components that are needed for your project. diff --git a/README-DEV.txt b/README-DEV.txt index c632346d03e..0734bf0b18f 100644 --- a/README-DEV.txt +++ b/README-DEV.txt @@ -55,6 +55,11 @@ To run tests: % phpunit --group Zend_Application + This will likely lead to errors, so it's usually best to specify a + specific component in which to run test: + + % phpunit --group ZF-XYZ Zend/Application + You can turn on conditional tests with the TestConfiguration.php file. To do so: diff --git a/README.txt b/README.txt index 7d573245646..a235523ecb1 100644 --- a/README.txt +++ b/README.txt @@ -7,6 +7,14 @@ Zend Framework 2.0.0dev1 THIS RELEASE IS A DEVELOPMENT RELEASE AND NOT INTENDED FOR PRODUCTION USE. PLEASE USE AT YOUR OWN RISK. +At this time, we have tested all functionality of Zend\Tool, and followed the +Quick Start application instructions, and all functionality works as it did in +the ZF1 series of releases. However, most Zend\Service components have not been +migrated to namespaces, and Zend\Db has not been completely vetted (in favor of +doing a complete refactor). Again, please use at your own risk, and be prepared +for major changes in APIs in the development and alpha milestones prior to the +first beta release. + NEW FEATURES ------------ @@ -24,6 +32,13 @@ INSTALLATION Please see INSTALL.txt. +CONTRIBUTING +------------ + +If you wish to contribute to Zend Framework 2.0, please make sure you have +signed a CLA (http://framework.zend.com/cla), and please read both the +README-DEV.txt and README-GIT.txt file. + QUESTIONS AND FEEDBACK ---------------------- From b54cb654df4bdc543c1fa24870fca37e9f55f8ab Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 3 Aug 2010 14:12:54 -0400 Subject: [PATCH 09/19] Add missing assignment - Added assignment that was skipped when merging from marc-mabe/zf2/CodeOptimations --- library/Zend/Amf/Server.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/Zend/Amf/Server.php b/library/Zend/Amf/Server.php index c8626efc020..4988b63cc2b 100644 --- a/library/Zend/Amf/Server.php +++ b/library/Zend/Amf/Server.php @@ -270,7 +270,8 @@ protected function _checkAcl($object, $function) return true; } if($object) { - $class = is_object($object) ? get_class($object) : $object; + $isObject = is_object($object); + $class = ($isObject) ? get_class($object) : $object; if(!$this->_acl->hasResource($class)) { $this->_acl->addResource(new \Zend\Acl\Resource\GenericResource($class)); } From b1420bf8bf5223e46f05b5363283a607c2dbd730 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 4 Aug 2010 11:27:28 -0400 Subject: [PATCH 10/19] Added serializable SPL data structures - Extended SplQueue, SplStack, and SplPriorityQueue to add the ability to serialize each, as well as provide toArray() methods. --- library/Zend/Stdlib/SplPriorityQueue.php | 77 ++++++++++++++++++++++ library/Zend/Stdlib/SplQueue.php | 48 ++++++++++++++ library/Zend/Stdlib/SplStack.php | 48 ++++++++++++++ tests/Zend/Stdlib/SplPriorityQueueTest.php | 46 +++++++++++++ tests/Zend/Stdlib/SplQueueTest.php | 39 +++++++++++ tests/Zend/Stdlib/SplStackTest.php | 41 ++++++++++++ 6 files changed, 299 insertions(+) create mode 100644 library/Zend/Stdlib/SplPriorityQueue.php create mode 100644 library/Zend/Stdlib/SplQueue.php create mode 100644 library/Zend/Stdlib/SplStack.php create mode 100644 tests/Zend/Stdlib/SplPriorityQueueTest.php create mode 100644 tests/Zend/Stdlib/SplQueueTest.php create mode 100644 tests/Zend/Stdlib/SplStackTest.php diff --git a/library/Zend/Stdlib/SplPriorityQueue.php b/library/Zend/Stdlib/SplPriorityQueue.php new file mode 100644 index 00000000000..1835aaa6a67 --- /dev/null +++ b/library/Zend/Stdlib/SplPriorityQueue.php @@ -0,0 +1,77 @@ + data pairs + * + * @return array + */ + public function toArray() + { + $this->setExtractFlags(self::EXTR_BOTH); + $array = array(); + while ($this->valid()) { + $array[] = $this->current(); + $this->next(); + } + $this->setExtractFlags(self::EXTR_DATA); + + // Iterating through a priority queue removes items + foreach ($array as $item) { + $this->insert($item['data'], $item['priority']); + } + + // Return only the data + $return = array(); + foreach ($array as $item) { + $return[$item['priority']] = $item['data']; + } + + return $return; + } + + /** + * Serialize + * + * @return array + */ + public function __sleep() + { + $this->_data = array(); + $this->setExtractFlags(self::EXTR_BOTH); + while ($this->valid()) { + $this->_data[] = $this->current(); + $this->next(); + } + $this->setExtractFlags(self::EXTR_DATA); + + // Iterating through a priority queue removes items + foreach ($this->_data as $item) { + $this->insert($item['data'], $item['priority']); + } + + return array('_data'); + } + + /** + * Deserialize + * + * @return void + */ + public function __wakeup() + { + foreach ($this->_data as $item) { + $this->insert($item['data'], $item['priority']); + } + $this->_data = array(); + } +} diff --git a/library/Zend/Stdlib/SplQueue.php b/library/Zend/Stdlib/SplQueue.php new file mode 100644 index 00000000000..83c7dcab947 --- /dev/null +++ b/library/Zend/Stdlib/SplQueue.php @@ -0,0 +1,48 @@ +_data = $this->toArray(); + return array('_data'); + } + + /** + * Unserialize + * + * @return void + */ + public function __wakeup() + { + foreach ($this->_data as $item) { + $this->push($item); + } + $this->_data = array(); + } +} diff --git a/library/Zend/Stdlib/SplStack.php b/library/Zend/Stdlib/SplStack.php new file mode 100644 index 00000000000..1bcc79466fe --- /dev/null +++ b/library/Zend/Stdlib/SplStack.php @@ -0,0 +1,48 @@ +_data = $this->toArray(); + return array('_data'); + } + + /** + * Unserialize + * + * @return void + */ + public function __wakeup() + { + foreach ($this->_data as $item) { + $this->unshift($item); + } + $this->_data = array(); + } +} diff --git a/tests/Zend/Stdlib/SplPriorityQueueTest.php b/tests/Zend/Stdlib/SplPriorityQueueTest.php new file mode 100644 index 00000000000..ae655bee7a5 --- /dev/null +++ b/tests/Zend/Stdlib/SplPriorityQueueTest.php @@ -0,0 +1,46 @@ +queue = new SplPriorityQueue(); + $this->queue->insert('foo', 3); + $this->queue->insert('bar', 4); + $this->queue->insert('baz', 2); + $this->queue->insert('bat', 1); + } + + public function testSerializationAndDeserializationShouldMaintainState() + { + $s = serialize($this->queue); + $unserialized = unserialize($s); + $count = count($this->queue); + $this->assertSame($count, count($unserialized), 'Expected count ' . $count . '; received ' . count($unserialized)); + + $expected = array(); + foreach ($this->queue as $item) { + $expected[] = $item; + } + $test = array(); + foreach ($unserialized as $item) { + $test[] = $item; + } + $this->assertSame($expected, $test, 'Expected: ' . var_export($expected, 1) . "\nReceived:" . var_export($test, 1)); + } + + public function testCanRetrieveQueueAsArray() + { + $expected = array( + 4 => 'bar', + 3 => 'foo', + 2 => 'baz', + 1 => 'bat', + ); + $test = $this->queue->toArray(); + $this->assertSame($expected, $test, var_export($test, 1)); + } +} diff --git a/tests/Zend/Stdlib/SplQueueTest.php b/tests/Zend/Stdlib/SplQueueTest.php new file mode 100644 index 00000000000..340ed57a9f0 --- /dev/null +++ b/tests/Zend/Stdlib/SplQueueTest.php @@ -0,0 +1,39 @@ +queue = new SplQueue(); + $this->queue->push('foo'); + $this->queue->push('bar'); + $this->queue->push('baz'); + } + + public function testSerializationAndDeserializationShouldMaintainState() + { + $s = serialize($this->queue); + $unserialized = unserialize($s); + $count = count($this->queue); + $this->assertSame($count, count($unserialized)); + + $expected = array(); + foreach ($this->queue as $item) { + $expected[] = $item; + } + $test = array(); + foreach ($unserialized as $item) { + $test[] = $item; + } + $this->assertSame($expected, $test); + } + + public function testCanRetrieveQueueAsArray() + { + $expected = array('foo', 'bar', 'baz'); + $this->assertSame($expected, $this->queue->toArray()); + } +} diff --git a/tests/Zend/Stdlib/SplStackTest.php b/tests/Zend/Stdlib/SplStackTest.php new file mode 100644 index 00000000000..0ca7a8ad907 --- /dev/null +++ b/tests/Zend/Stdlib/SplStackTest.php @@ -0,0 +1,41 @@ +stack = new SplStack(); + $this->stack->push('foo'); + $this->stack->push('bar'); + $this->stack->push('baz'); + $this->stack->push('bat'); + } + + public function testSerializationAndDeserializationShouldMaintainState() + { + $s = serialize($this->stack); + $unserialized = unserialize($s); + $count = count($this->stack); + $this->assertSame($count, count($unserialized)); + + $expected = array(); + foreach ($this->stack as $item) { + $expected[] = $item; + } + $test = array(); + foreach ($unserialized as $item) { + $test[] = $item; + } + $this->assertSame($expected, $test); + } + + public function testCanRetrieveQueueAsArray() + { + $expected = array('bat', 'baz', 'bar', 'foo'); + $test = $this->stack->toArray(); + $this->assertSame($expected, $test, var_export($test, 1)); + } +} From 263ace409b8aaecca50f4e104910acb959c38d0e Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 4 Aug 2010 11:33:49 -0400 Subject: [PATCH 11/19] Use Zend\Stdlib\SplQueue in FlashMessenger - Modified FlashMessenger to use SplQueue; likely needs a bit more work to integrate properly, but should allow serialization of FM. --- .../Controller/Action/Helper/FlashMessenger.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/library/Zend/Controller/Action/Helper/FlashMessenger.php b/library/Zend/Controller/Action/Helper/FlashMessenger.php index 8ac7ed57d1d..47f417fdb2b 100644 --- a/library/Zend/Controller/Action/Helper/FlashMessenger.php +++ b/library/Zend/Controller/Action/Helper/FlashMessenger.php @@ -23,7 +23,8 @@ * @namespace */ namespace Zend\Controller\Action\Helper; -use Zend\Session; +use Zend\Session, + Zend\Stdlib\SplQueue; /** * Flash Messenger - implement session-based messages @@ -133,11 +134,13 @@ public function addMessage($message) self::$_session->setExpirationHops(1, null, true); } - if (!is_array(self::$_session->{$this->_namespace})) { - self::$_session->{$this->_namespace} = array(); + if (!isset(self::$_session->{$this->_namespace}) + || !(self::$_session->{$this->_namespace} instanceof SplQueue) + ) { + self::$_session->{$this->_namespace} = new SplQueue(); } - self::$_session->{$this->_namespace}[] = $message; + self::$_session->{$this->_namespace}->push($message); return $this; } @@ -160,7 +163,7 @@ public function hasMessages() public function getMessages() { if ($this->hasMessages()) { - return self::$_messages[$this->_namespace]; + return self::$_messages[$this->_namespace]->toArray(); } return array(); @@ -201,7 +204,7 @@ public function hasCurrentMessages() public function getCurrentMessages() { if ($this->hasCurrentMessages()) { - return self::$_session->{$this->_namespace}; + return self::$_session->{$this->_namespace}->toArray(); } return array(); From 957d3ba1b7fdcc28883340bfc7ffe0fcb881649b Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 5 Aug 2010 08:23:32 -0400 Subject: [PATCH 12/19] FlashMessenger debugging - Added getIterator() method to Session\Container; pulls ArrayObject container from session storage and returns its iterator, allowing iteration over contents of the container. - Added cleanup code to FlashMessenger to ensure iterator is not altered while retrieving messages. --- .../Controller/Action/Helper/FlashMessenger.php | 7 +++++++ library/Zend/Session/Container.php | 13 +++++++++++++ 2 files changed, 20 insertions(+) diff --git a/library/Zend/Controller/Action/Helper/FlashMessenger.php b/library/Zend/Controller/Action/Helper/FlashMessenger.php index 47f417fdb2b..934b2ba29ca 100644 --- a/library/Zend/Controller/Action/Helper/FlashMessenger.php +++ b/library/Zend/Controller/Action/Helper/FlashMessenger.php @@ -78,8 +78,15 @@ public function __construct() { if (!self::$_session instanceof Session\Container) { self::$_session = new Session\Container($this->getName()); + + // Should not modify the iterator while iterating; aggregate + // namespaces so they may be deleted after retrieving messages. + $namespaces = array(); foreach (self::$_session as $namespace => $messages) { self::$_messages[$namespace] = $messages; + $namespaces[] = $namespace; + } + foreach ($namespaces as $namespace) { unset(self::$_session->{$namespace}); } } diff --git a/library/Zend/Session/Container.php b/library/Zend/Session/Container.php index f66c87514be..5e1c2013fd6 100644 --- a/library/Zend/Session/Container.php +++ b/library/Zend/Session/Container.php @@ -392,6 +392,19 @@ public function offsetUnset($key) unset($storage[$name][$key]); } + /** + * Iterate over session container + * + * @return Iterator + */ + public function getIterator() + { + $storage = $this->_verifyNamespace(); + $storage = $this->_getStorage(); + $container = $storage[$this->getName()]; + return $container->getIterator(); + } + /** * Set expiration TTL * From 26cf5d71064d6180378908bd1afb9e573af1d4c8 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 5 Aug 2010 10:09:10 -0400 Subject: [PATCH 13/19] Session Container iteration expires keys - Added logic to ensure that iteration honors both expiration timestamp and expiration hops as set in the storage container. --- library/Zend/Session/Container.php | 58 ++++++++++++++++++++++--- tests/Zend/Session/ContainerTest.php | 64 ++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 6 deletions(-) diff --git a/library/Zend/Session/Container.php b/library/Zend/Session/Container.php index 5e1c2013fd6..56262604582 100644 --- a/library/Zend/Session/Container.php +++ b/library/Zend/Session/Container.php @@ -209,16 +209,16 @@ protected function _verifyNamespace($createContainer = true) * * Returns true if the key has expired, false otherwise. * - * @param string $key + * @param null|string $key * @return bool */ - protected function _expireKeys($key) + protected function _expireKeys($key = null) { $storage = $this->_verifyNamespace(); $name = $this->getName(); // Return early if key not found - if (!isset($storage[$name][$key])) { + if ((null !== $key) && !isset($storage[$name][$key])) { return true; } @@ -247,6 +247,8 @@ protected function _expireKeys($key) protected function _expireByExpiryTime(Storage $storage, $name, $key) { $metadata = $storage->getMetadata($name); + + // Global container expiry if (is_array($metadata) && isset($metadata['EXPIRE']) && ($_SERVER['REQUEST_TIME'] > $metadata['EXPIRE']) @@ -257,7 +259,9 @@ protected function _expireByExpiryTime(Storage $storage, $name, $key) return true; } - if (is_array($metadata) + // Expire individual key + if ((null !== $key) + && is_array($metadata) && isset($metadata['EXPIRE_KEYS']) && isset($metadata['EXPIRE_KEYS'][$key]) && ($_SERVER['REQUEST_TIME'] > $metadata['EXPIRE_KEYS'][$key]) @@ -268,6 +272,23 @@ protected function _expireByExpiryTime(Storage $storage, $name, $key) return true; } + // Find any keys that have expired + if ((null === $key) + && is_array($metadata) + && isset($metadata['EXPIRE_KEYS']) + ) { + foreach (array_keys($metadata['EXPIRE_KEYS']) as $key) { + if ($_SERVER['REQUEST_TIME'] > $metadata['EXPIRE_KEYS'][$key]) { + unset($metadata['EXPIRE_KEYS'][$key]); + if (isset($storage[$name][$key])) { + unset($storage[$name][$key]); + } + } + } + $storage->setMetadata($name, $metadata, true); + return true; + } + return false; } @@ -286,6 +307,8 @@ protected function _expireByHops(Storage $storage, $name, $key) { $ts = $storage->getRequestAccessTime(); $metadata = $storage->getMetadata($name); + + // Global container expiry if (is_array($metadata) && isset($metadata['EXPIRE_HOPS']) && ($ts > $metadata['EXPIRE_HOPS']['ts']) @@ -302,7 +325,9 @@ protected function _expireByHops(Storage $storage, $name, $key) return false; } - if (is_array($metadata) + // Single key expiry + if ((null !== $key) + && is_array($metadata) && isset($metadata['EXPIRE_HOPS_KEYS']) && isset($metadata['EXPIRE_HOPS_KEYS'][$key]) && ($ts > $metadata['EXPIRE_HOPS_KEYS'][$key]['ts']) @@ -319,6 +344,27 @@ protected function _expireByHops(Storage $storage, $name, $key) return false; } + // Find all expired keys + if ((null === $key) + && is_array($metadata) + && isset($metadata['EXPIRE_HOPS_KEYS']) + ) { + foreach (array_keys($metadata['EXPIRE_HOPS_KEYS']) as $key) { + if ($ts > $metadata['EXPIRE_HOPS_KEYS'][$key]['ts']) { + $metadata['EXPIRE_HOPS_KEYS'][$key]['hops']--; + if (-1 === $metadata['EXPIRE_HOPS_KEYS'][$key]['hops']) { + unset($metadata['EXPIRE_HOPS_KEYS'][$key]); + $storage->setMetadata($name, $metadata, true); + unset($storage[$name][$key]); + continue; + } + $metadata['EXPIRE_HOPS_KEYS'][$key]['ts'] = $ts; + } + } + $storage->setMetadata($name, $metadata, true); + return false; + } + return false; } @@ -399,7 +445,7 @@ public function offsetUnset($key) */ public function getIterator() { - $storage = $this->_verifyNamespace(); + $this->_expireKeys(); $storage = $this->_getStorage(); $container = $storage[$this->getName()]; return $container->getIterator(); diff --git a/tests/Zend/Session/ContainerTest.php b/tests/Zend/Session/ContainerTest.php index a32117c230b..f7733db1bf2 100644 --- a/tests/Zend/Session/ContainerTest.php +++ b/tests/Zend/Session/ContainerTest.php @@ -379,4 +379,68 @@ public function testKeysExpireAfterSpecifiedHops() $this->assertEquals('baz', $this->container->bar); $this->assertNull($this->container->baz); } + + public function testCanIterateOverContainer() + { + $this->container->foo = 'bar'; + $this->container->bar = 'baz'; + $this->container->baz = 'bat'; + $expected = array( + 'foo' => 'bar', + 'bar' => 'baz', + 'baz' => 'bat', + ); + $test = array(); + foreach ($this->container as $key => $value) { + $test[$key] = $value; + } + $this->assertSame($expected, $test); + } + + public function testIterationHonorsExpirationHops() + { + $this->container->foo = 'bar'; + $this->container->bar = 'baz'; + $this->container->baz = 'bat'; + $this->container->setExpirationHops(1, array('foo', 'baz')); + + $storage = $this->manager->getStorage(); + $ts = $storage->getRequestAccessTime(); + + // First hop + $storage->setMetadata('_REQUEST_ACCESS_TIME', $ts + 60); + $expected = array( + 'foo' => 'bar', + 'bar' => 'baz', + 'baz' => 'bat', + ); + $test = array(); + foreach ($this->container as $key => $value) { + $test[$key] = $value; + } + $this->assertSame($expected, $test); + + // Second hop + $storage->setMetadata('_REQUEST_ACCESS_TIME', $ts + 120); + $expected = array('bar' => 'baz'); + $test = array(); + foreach ($this->container as $key => $value) { + $test[$key] = $value; + } + $this->assertSame($expected, $test); + } + + public function testIterationHonorsExpirationTimestamps() + { + $this->container->foo = 'bar'; + $this->container->bar = 'baz'; + $storage = $this->manager->getStorage(); + $storage->setMetadata('Default', array('EXPIRE_KEYS' => array('foo' => $_SERVER['REQUEST_TIME'] - 18600))); + $expected = array('bar' => 'baz'); + $test = array(); + foreach ($this->container as $key => $value) { + $test[$key] = $value; + } + $this->assertSame($expected, $test); + } } From 9b2daff2644d1683da88e81b04b115c2df92bb8f Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 5 Aug 2010 12:50:10 -0400 Subject: [PATCH 14/19] Added class/file docblocks - added class and file docblocks to SPL extensions --- library/Zend/Stdlib/SplPriorityQueue.php | 30 ++++++++++++++++++++++++ library/Zend/Stdlib/SplQueue.php | 30 ++++++++++++++++++++++++ library/Zend/Stdlib/SplStack.php | 30 ++++++++++++++++++++++++ 3 files changed, 90 insertions(+) diff --git a/library/Zend/Stdlib/SplPriorityQueue.php b/library/Zend/Stdlib/SplPriorityQueue.php index 1835aaa6a67..cd1f373f16f 100644 --- a/library/Zend/Stdlib/SplPriorityQueue.php +++ b/library/Zend/Stdlib/SplPriorityQueue.php @@ -1,6 +1,36 @@ Date: Thu, 5 Aug 2010 15:43:53 -0400 Subject: [PATCH 15/19] Do not use autoloader when plugin loading - Changed class_exists() check to not autoload; prevents E_NOTICE on not-found errors. --- library/Zend/Loader/PluginLoader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Loader/PluginLoader.php b/library/Zend/Loader/PluginLoader.php index baa465fd588..a95754e929a 100644 --- a/library/Zend/Loader/PluginLoader.php +++ b/library/Zend/Loader/PluginLoader.php @@ -389,7 +389,7 @@ public function load($name, $throwExceptions = true) foreach ($registry as $prefix => $paths) { $className = $prefix . $name; - if (class_exists($className, true)) { + if (class_exists($className, false)) { $found = true; break; } From 922afa967aeeae729498d665ca4e0cfd611a9cab Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 5 Aug 2010 15:45:59 -0400 Subject: [PATCH 16/19] BBCode -> Bbcode - Switch from acronym to mixed case --- library/Zend/Markup/Parser/{BBCode.php => Bbcode.php} | 2 +- tests/Zend/Markup/BBCodeAndHTMLTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename library/Zend/Markup/Parser/{BBCode.php => Bbcode.php} (99%) diff --git a/library/Zend/Markup/Parser/BBCode.php b/library/Zend/Markup/Parser/Bbcode.php similarity index 99% rename from library/Zend/Markup/Parser/BBCode.php rename to library/Zend/Markup/Parser/Bbcode.php index 56df7ae193c..cf5ded8f6fb 100644 --- a/library/Zend/Markup/Parser/BBCode.php +++ b/library/Zend/Markup/Parser/Bbcode.php @@ -39,7 +39,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class BBCode implements Parser +class Bbcode implements Parser { const NEWLINE = "[newline\0]"; diff --git a/tests/Zend/Markup/BBCodeAndHTMLTest.php b/tests/Zend/Markup/BBCodeAndHTMLTest.php index 33743b7fc48..219343e2fab 100644 --- a/tests/Zend/Markup/BBCodeAndHTMLTest.php +++ b/tests/Zend/Markup/BBCodeAndHTMLTest.php @@ -55,7 +55,7 @@ class BbcodeAndHtmlTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->_markup = \Zend\Markup\Markup::factory('BBCode', 'HTML'); + $this->_markup = \Zend\Markup\Markup::factory('Bbcode', 'HTML'); } /** From 004fa93d15d7a1cdcb17a75a0a490c774dafc2e3 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 5 Aug 2010 15:55:27 -0400 Subject: [PATCH 17/19] HTML/URL switch to mixed case - Switch ACRONYM casing to MixedCase for "HTML" and "URL" subcomponents --- library/Zend/Markup/Markup.php | 2 +- library/Zend/Markup/Parser/Textile.php | 24 +++++++++++++++++++ .../Markup/Renderer/{HTML.php => Html.php} | 8 ++----- .../AbstractHtml.php} | 12 +++++----- .../Renderer/Markup/{HTML => Html}/Code.php | 6 ++--- .../Renderer/Markup/{HTML => Html}/Img.php | 10 ++++---- .../Markup/{HTML => Html}/ListItem.php | 6 ++--- .../Markup/{HTML => Html}/Replace.php | 6 ++--- .../Markup/{HTML/URL.php => Html/Url.php} | 10 ++++---- tests/Zend/Markup/BBCodeAndHTMLTest.php | 8 +++---- .../Markup/TestAsset/Parser/MockParser.php | 8 +++++++ .../TestAsset/Renderer/{HTML => Html}/Bar.php | 2 +- 12 files changed, 65 insertions(+), 37 deletions(-) rename library/Zend/Markup/Renderer/{HTML.php => Html.php} (98%) rename library/Zend/Markup/Renderer/Markup/{HTML/AbstractHTML.php => Html/AbstractHtml.php} (90%) rename library/Zend/Markup/Renderer/Markup/{HTML => Html}/Code.php (90%) rename library/Zend/Markup/Renderer/Markup/{HTML => Html}/Img.php (90%) rename library/Zend/Markup/Renderer/Markup/{HTML => Html}/ListItem.php (95%) rename library/Zend/Markup/Renderer/Markup/{HTML => Html}/Replace.php (92%) rename library/Zend/Markup/Renderer/Markup/{HTML/URL.php => Html/Url.php} (88%) rename tests/Zend/Markup/TestAsset/Renderer/{HTML => Html}/Bar.php (96%) diff --git a/library/Zend/Markup/Markup.php b/library/Zend/Markup/Markup.php index 92c82862892..28eae493b4c 100644 --- a/library/Zend/Markup/Markup.php +++ b/library/Zend/Markup/Markup.php @@ -122,7 +122,7 @@ public static function addRendererPath($prefix, $path) * @param array $options * @return \Zend\Markup\Renderer\AbstractRenderer */ - public static function factory($parser, $renderer = 'HTML', array $options = array()) + public static function factory($parser, $renderer = 'Html', array $options = array()) { $parserClass = self::getParserLoader()->load($parser); $rendererClass = self::getRendererLoader()->load($renderer); diff --git a/library/Zend/Markup/Parser/Textile.php b/library/Zend/Markup/Parser/Textile.php index 917e7c540e1..c018ce7189a 100644 --- a/library/Zend/Markup/Parser/Textile.php +++ b/library/Zend/Markup/Parser/Textile.php @@ -561,4 +561,28 @@ protected function _extractAttributes(array $matches) return $attributes; } + /** + * Build a tree with a certain strategy + * + * @todo IMPLEMENT + * @param array $tokens + * @param string $strategy + * + * @return \Zend\Markup\TokenList + */ + public function buildTree(array $tokens, $strategy = 'default') + { + } + + /** + * Tokenize a string + * + * @param string $value + * + * @todo IMPLEMENT + * @return array + */ + public function tokenize($value) + { + } } diff --git a/library/Zend/Markup/Renderer/HTML.php b/library/Zend/Markup/Renderer/Html.php similarity index 98% rename from library/Zend/Markup/Renderer/HTML.php rename to library/Zend/Markup/Renderer/Html.php index cce363103b2..bda97a8ca97 100644 --- a/library/Zend/Markup/Renderer/HTML.php +++ b/library/Zend/Markup/Renderer/Html.php @@ -43,7 +43,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class HTML extends AbstractRenderer +class Html extends AbstractRenderer { /** @@ -95,7 +95,7 @@ public function __construct($options = array()) } $this->_pluginLoader = new PluginLoader(array( - 'Zend\Markup\Renderer\Markup\HTML' => 'Zend/Markup/Renderer/Markup/HTML/' + 'Zend\Markup\Renderer\Markup\Html' => 'Zend/Markup/Renderer/Markup/Html/' )); if (!isset($options['useDefaultMarkups']) && isset($options['useDefaultTags'])) { @@ -220,10 +220,6 @@ protected function _defineDefaultMarkups() ), // callback tags 'url' => array( - 'type' => 16, // self::TYPE_ALIAS - 'name' => 'URL', - ), - 'URL' => array( 'type' => 6, // self::TYPE_CALLBACK | self::TAG_NORMAL 'callback' => null, 'group' => 'inline', diff --git a/library/Zend/Markup/Renderer/Markup/HTML/AbstractHTML.php b/library/Zend/Markup/Renderer/Markup/Html/AbstractHtml.php similarity index 90% rename from library/Zend/Markup/Renderer/Markup/HTML/AbstractHTML.php rename to library/Zend/Markup/Renderer/Markup/Html/AbstractHtml.php index 79033d55320..3363e2c3815 100644 --- a/library/Zend/Markup/Renderer/Markup/HTML/AbstractHTML.php +++ b/library/Zend/Markup/Renderer/Markup/Html/AbstractHtml.php @@ -22,7 +22,7 @@ /** * @namespace */ -namespace Zend\Markup\Renderer\Markup\HTML; +namespace Zend\Markup\Renderer\Markup\Html; use Zend\Markup\Renderer\Markup\AbstractMarkup, Zend\Markup; @@ -34,11 +34,11 @@ * @uses \Zend\Markup\Renderer\AbstractRenderer * @category Zend * @package Zend_Markup - * @subpackage Renderer_Markup_HTML + * @subpackage Renderer_Markup_Html * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -abstract class AbstractHTML extends AbstractMarkup +abstract class AbstractHtml extends AbstractMarkup { /** @@ -54,7 +54,7 @@ abstract class AbstractHTML extends AbstractMarkup * * @param array $attributes * - * @return \Zend\Markup\Renderer\Markup\HTML\AbstractHTML + * @return \Zend\Markup\Renderer\Markup\Html\AbstractHtml */ public function setAttributes(array $attributes) { @@ -69,7 +69,7 @@ public function setAttributes(array $attributes) * @param string $name * @param string $value * - * @return \Zend\Markup\Renderer\Markup\HTML\AbstractHTML + * @return \Zend\Markup\Renderer\Markup\Html\AbstractHtml */ public function addAttribute($name, $value) { @@ -83,7 +83,7 @@ public function addAttribute($name, $value) * * @param string $name * - * @return \Zend\Markup\Renderer\Markup\HTML\AbstractHTML + * @return \Zend\Markup\Renderer\Markup\Html\AbstractHtml */ public function removeAttribute($name) { diff --git a/library/Zend/Markup/Renderer/Markup/HTML/Code.php b/library/Zend/Markup/Renderer/Markup/Html/Code.php similarity index 90% rename from library/Zend/Markup/Renderer/Markup/HTML/Code.php rename to library/Zend/Markup/Renderer/Markup/Html/Code.php index e7472fb1e5a..2affc54f83c 100644 --- a/library/Zend/Markup/Renderer/Markup/HTML/Code.php +++ b/library/Zend/Markup/Renderer/Markup/Html/Code.php @@ -23,13 +23,13 @@ /** * @namespace */ -namespace Zend\Markup\Renderer\Markup\HTML; +namespace Zend\Markup\Renderer\Markup\Html; use Zend\Markup; /** * Code markup for HTML * - * @uses \Zend\Markup\Renderer\Markup\HTML\AbstractHTML + * @uses \Zend\Markup\Renderer\Markup\Html\AbstractHtml * @uses \Zend\Markup\Token * @category Zend * @package Zend_Markup @@ -37,7 +37,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Code extends AbstractHTML +class Code extends AbstractHtml { /** diff --git a/library/Zend/Markup/Renderer/Markup/HTML/Img.php b/library/Zend/Markup/Renderer/Markup/Html/Img.php similarity index 90% rename from library/Zend/Markup/Renderer/Markup/HTML/Img.php rename to library/Zend/Markup/Renderer/Markup/Html/Img.php index e724043ee40..9aa08e62755 100644 --- a/library/Zend/Markup/Renderer/Markup/HTML/Img.php +++ b/library/Zend/Markup/Renderer/Markup/Html/Img.php @@ -23,15 +23,15 @@ /** * @namespace */ -namespace Zend\Markup\Renderer\Markup\HTML; +namespace Zend\Markup\Renderer\Markup\Html; use Zend\Markup\Renderer\Markup; use Zend\Markup\Token; /** * Image markup for HTML * - * @uses \Zend\Markup\Renderer\HTML - * @uses \Zend\Markup\Renderer\Markup\HTML\AbstractHTML + * @uses \Zend\Markup\Renderer\Html + * @uses \Zend\Markup\Renderer\Markup\Html\AbstractHtml * @uses \Zend\Markup\Token * @category Zend * @package Zend_Markup @@ -39,7 +39,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Img extends AbstractHTML +class Img extends AbstractHtml { /** @@ -60,7 +60,7 @@ public function __invoke(Token $token, $text) // check if the URL is valid // TODO: use \Zend\Uri for this - if (!\Zend\Markup\Renderer\HTML::isValidUri($uri)) { + if (!\Zend\Markup\Renderer\Html::isValidUri($uri)) { return $text; } diff --git a/library/Zend/Markup/Renderer/Markup/HTML/ListItem.php b/library/Zend/Markup/Renderer/Markup/Html/ListItem.php similarity index 95% rename from library/Zend/Markup/Renderer/Markup/HTML/ListItem.php rename to library/Zend/Markup/Renderer/Markup/Html/ListItem.php index dd1e32161e2..2ad8f5d3734 100644 --- a/library/Zend/Markup/Renderer/Markup/HTML/ListItem.php +++ b/library/Zend/Markup/Renderer/Markup/Html/ListItem.php @@ -23,13 +23,13 @@ /** * @namespace */ -namespace Zend\Markup\Renderer\Markup\HTML; +namespace Zend\Markup\Renderer\Markup\Html; use Zend\Markup; /** * List item markup * - * @uses \Zend\Markup\Renderer\Markup\HTML\AbstractHTML + * @uses \Zend\Markup\Renderer\Markup\Html\AbstractHtml * @uses \Zend\Markup\Token * @category Zend * @package Zend_Markup @@ -37,7 +37,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class ListItem extends AbstractHTML +class ListItem extends AbstractHtml { /** diff --git a/library/Zend/Markup/Renderer/Markup/HTML/Replace.php b/library/Zend/Markup/Renderer/Markup/Html/Replace.php similarity index 92% rename from library/Zend/Markup/Renderer/Markup/HTML/Replace.php rename to library/Zend/Markup/Renderer/Markup/Html/Replace.php index ace0e89c8a9..c7bc70989c2 100644 --- a/library/Zend/Markup/Renderer/Markup/HTML/Replace.php +++ b/library/Zend/Markup/Renderer/Markup/Html/Replace.php @@ -22,13 +22,13 @@ /** * @namespace */ -namespace Zend\Markup\Renderer\Markup\HTML; +namespace Zend\Markup\Renderer\Markup\Html; use Zend\Markup; /** * Simple replace markup for HTML * - * @uses \Zend\Markup\Renderer\Markup\HTML\AbstractHTML + * @uses \Zend\Markup\Renderer\Markup\Html\AbstractHtml * @uses \Zend\Markup\Token * @category Zend * @package Zend_Markup @@ -36,7 +36,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class Replace extends AbstractHTML +class Replace extends AbstractHtml { /** diff --git a/library/Zend/Markup/Renderer/Markup/HTML/URL.php b/library/Zend/Markup/Renderer/Markup/Html/Url.php similarity index 88% rename from library/Zend/Markup/Renderer/Markup/HTML/URL.php rename to library/Zend/Markup/Renderer/Markup/Html/Url.php index 18132e39b78..88f0d769107 100644 --- a/library/Zend/Markup/Renderer/Markup/HTML/URL.php +++ b/library/Zend/Markup/Renderer/Markup/Html/Url.php @@ -23,14 +23,14 @@ /** * @namespace */ -namespace Zend\Markup\Renderer\Markup\HTML; +namespace Zend\Markup\Renderer\Markup\Html; use Zend\Markup\Token; /** * URL markup for HTML * - * @uses \Zend\Markup\Renderer\HTML - * @uses \Zend\Markup\Renderer\Markup\HTML\AbstractHTML + * @uses \Zend\Markup\Renderer\Html + * @uses \Zend\Markup\Renderer\Markup\Html\AbstractHtml * @uses \Zend\Markup\Token * @category Zend * @package Zend_Markup @@ -38,7 +38,7 @@ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class URL extends AbstractHTML +class Url extends AbstractHtml { /** @@ -63,7 +63,7 @@ public function __invoke(Token $token, $text) // check if the URL is valid // TODO: use the new Zend\Uri for this - if (!\Zend\Markup\Renderer\HTML::isValidUri($uri)) { + if (!\Zend\Markup\Renderer\Html::isValidUri($uri)) { return $text; } diff --git a/tests/Zend/Markup/BBCodeAndHTMLTest.php b/tests/Zend/Markup/BBCodeAndHTMLTest.php index 219343e2fab..2e481b9be36 100644 --- a/tests/Zend/Markup/BBCodeAndHTMLTest.php +++ b/tests/Zend/Markup/BBCodeAndHTMLTest.php @@ -26,7 +26,7 @@ namespace ZendTest\Markup; use Zend\Markup\Renderer\AbstractRenderer, - Zend\Markup\Renderer\HTML as HTMLRenderer, + Zend\Markup\Renderer\Html as HTMLRenderer, Zend\Filter; /** @@ -55,7 +55,7 @@ class BbcodeAndHtmlTest extends \PHPUnit_Framework_TestCase */ public function setUp() { - $this->_markup = \Zend\Markup\Markup::factory('Bbcode', 'HTML'); + $this->_markup = \Zend\Markup\Markup::factory('Bbcode', 'Html'); } /** @@ -131,8 +131,8 @@ public function testExceptionParserEmptyInput() public function testAddTags() { $this->_markup->getPluginLoader()->addPrefixPath( - 'ZendTest\Markup\TestAsset\Renderer\HTML', - 'Zend/Markup/TestAsset/Renderer/HTML' + 'ZendTest\Markup\TestAsset\Renderer\Html', + 'Zend/Markup/TestAsset/Renderer/Html' ); $this->_markup->addMarkup( diff --git a/tests/Zend/Markup/TestAsset/Parser/MockParser.php b/tests/Zend/Markup/TestAsset/Parser/MockParser.php index 862920f5f1a..603b13d44f8 100644 --- a/tests/Zend/Markup/TestAsset/Parser/MockParser.php +++ b/tests/Zend/Markup/TestAsset/Parser/MockParser.php @@ -82,4 +82,12 @@ public function parse($value) return $tree; } + + public function buildTree(array $tokens, $strategy = 'default') + { + } + + public function tokenize($value) + { + } } diff --git a/tests/Zend/Markup/TestAsset/Renderer/HTML/Bar.php b/tests/Zend/Markup/TestAsset/Renderer/Html/Bar.php similarity index 96% rename from tests/Zend/Markup/TestAsset/Renderer/HTML/Bar.php rename to tests/Zend/Markup/TestAsset/Renderer/Html/Bar.php index e339ded39b5..2a33431decf 100644 --- a/tests/Zend/Markup/TestAsset/Renderer/HTML/Bar.php +++ b/tests/Zend/Markup/TestAsset/Renderer/Html/Bar.php @@ -23,7 +23,7 @@ /** * @namespace */ -namespace ZendTest\Markup\TestAsset\Renderer\HTML; +namespace ZendTest\Markup\TestAsset\Renderer\Html; use Zend\Markup\Renderer\AbstractRenderer; From 1eac6754be0c35798ce219af8b23c499a29c6a18 Mon Sep 17 00:00:00 2001 From: Ralph Schindler Date: Fri, 6 Aug 2010 12:23:47 -0500 Subject: [PATCH 18/19] Small fix for default "namespace" inside FlashMessenger Action Helper --- library/Zend/Controller/Action/Helper/FlashMessenger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Zend/Controller/Action/Helper/FlashMessenger.php b/library/Zend/Controller/Action/Helper/FlashMessenger.php index 934b2ba29ca..65e5dc9054a 100644 --- a/library/Zend/Controller/Action/Helper/FlashMessenger.php +++ b/library/Zend/Controller/Action/Helper/FlashMessenger.php @@ -66,7 +66,7 @@ class FlashMessenger extends AbstractHelper implements \IteratorAggregate, \Coun * * @var string */ - protected $_namespace = 'application'; + protected $_namespace = 'default'; /** * __construct() - Instance constructor, needed to get iterators, etc From edeeaffea98908848a9441e81b5a65c53c837681 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 11 Aug 2010 08:44:37 -0400 Subject: [PATCH 19/19] Fixed references to FirePhp - s/FirePhp\\FirePhp/FirePhp/g - Patch suggested by Alexander Thomas --- library/Zend/Log/Writer/Firebug.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/library/Zend/Log/Writer/Firebug.php b/library/Zend/Log/Writer/Firebug.php index b96ada41a43..1f521b228e7 100644 --- a/library/Zend/Log/Writer/Firebug.php +++ b/library/Zend/Log/Writer/Firebug.php @@ -33,7 +33,7 @@ * @uses \Zend\Log\Logger * @uses \Zend\Log\Formatter\Firebug * @uses \Zend\Log\Writer\AbstractWriter - * @uses \Zend\Wildfire\Plugin\FirePhp\FirePhp + * @uses \Zend\Wildfire\Plugin\FirePhp * @category Zend * @package Zend_Log * @subpackage Writer @@ -47,20 +47,20 @@ class Firebug extends AbstractWriter * Maps logging priorities to logging display styles * @var array */ - protected $_priorityStyles = array(Log\Logger::EMERG => FirePhp\FirePhp::ERROR, - Log\Logger::ALERT => FirePhp\FirePhp::ERROR, - Log\Logger::CRIT => FirePhp\FirePhp::ERROR, - Log\Logger::ERR => FirePhp\FirePhp::ERROR, - Log\Logger::WARN => FirePhp\FirePhp::WARN, - Log\Logger::NOTICE => FirePhp\FirePhp::INFO, - Log\Logger::INFO => FirePhp\FirePhp::INFO, - Log\Logger::DEBUG => FirePhp\FirePhp::LOG); + protected $_priorityStyles = array(Log\Logger::EMERG => FirePhp::ERROR, + Log\Logger::ALERT => FirePhp::ERROR, + Log\Logger::CRIT => FirePhp::ERROR, + Log\Logger::ERR => FirePhp::ERROR, + Log\Logger::WARN => FirePhp::WARN, + Log\Logger::NOTICE => FirePhp::INFO, + Log\Logger::INFO => FirePhp::INFO, + Log\Logger::DEBUG => FirePhp::LOG); /** * The default logging style for un-mapped priorities * @var string */ - protected $_defaultPriorityStyle = FirePhp\FirePhp::LOG; + protected $_defaultPriorityStyle = FirePhp::LOG; /** * Flag indicating whether the log writer is enabled @@ -191,9 +191,9 @@ protected function _write($event) $label = isset($event['firebugLabel'])?$event['firebugLabel']:null; - FirePhp\FirePhp::getInstance()->send($message, - $label, - $type, - array('traceOffset'=>6)); + FirePhp::getInstance()->send($message, + $label, + $type, + array('traceOffset'=>6)); } }