From 5d7e657cf31c01e03dcf25dbd836e0b29b93584f Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Wed, 30 Jun 2010 15:52:10 -0400 Subject: [PATCH 1/3] Dispatcher cleanup - s/Zend\Controller\Dispatcher\DispatcherInterface/Zend\Controller\Dispatcher/ - updated all classes and tests referencing it - updated migration classmap --- src/PHPUnit/ControllerTestCase.php | 8 ++++---- test/PHPUnit/ControllerTestCaseTest.php | 2 +- test/PHPUnit/_files/bootstrap.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/PHPUnit/ControllerTestCase.php b/src/PHPUnit/ControllerTestCase.php index 26429b8f42..83a89688d2 100644 --- a/src/PHPUnit/ControllerTestCase.php +++ b/src/PHPUnit/ControllerTestCase.php @@ -32,7 +32,7 @@ * * @uses PHPUnit_Framework_TestCase * @uses PHPUnit_Runner_Version - * @uses \Zend\Controller\Action\HelperBroker\HelperBroker + * @uses \Zend\Controller\Action\HelperBroker * @uses \Zend\Controller\Front * @uses \Zend\Controller\Request\HttpTestCase * @uses \Zend\Controller\Response\HttpTestCase @@ -172,11 +172,11 @@ final public function bootstrap() public function dispatch($url = null) { // redirector should not exit - $redirector = HelperBroker\HelperBroker::getStaticHelper('redirector'); + $redirector = HelperBroker::getStaticHelper('redirector'); $redirector->setExit(false); // json helper should not exit - $json = HelperBroker\HelperBroker::getStaticHelper('JSON'); + $json = HelperBroker::getStaticHelper('JSON'); $json->suppressExit = true; $request = $this->getRequest(); @@ -217,7 +217,7 @@ public function reset() $this->resetRequest(); $this->resetResponse(); \Zend\Layout\Layout::resetMvcInstance(); - HelperBroker\HelperBroker::resetHelpers(); + HelperBroker::resetHelpers(); $this->frontController->resetInstance(); //\Zend\Session\Manager::$_unitTestEnabled = true; } diff --git a/test/PHPUnit/ControllerTestCaseTest.php b/test/PHPUnit/ControllerTestCaseTest.php index ad948f51e7..8916545004 100644 --- a/test/PHPUnit/ControllerTestCaseTest.php +++ b/test/PHPUnit/ControllerTestCaseTest.php @@ -26,7 +26,7 @@ namespace ZendTest\Test\PHPUnit; use Zend\Application, Zend\Controller, - Zend\Controller\Action\HelperBroker\HelperBroker, + Zend\Controller\Action\HelperBroker, Zend\Controller\Dispatcher, Zend\Controller\Plugin, Zend\Controller\Request, diff --git a/test/PHPUnit/_files/bootstrap.php b/test/PHPUnit/_files/bootstrap.php index c40da60c9c..458eadc6b0 100644 --- a/test/PHPUnit/_files/bootstrap.php +++ b/test/PHPUnit/_files/bootstrap.php @@ -33,7 +33,7 @@ ->registerPlugin($plugin) ->setRouter($router) ->setDispatcher($dispatcher); -$viewRenderer = \Zend\Controller\Action\HelperBroker\HelperBroker::getStaticHelper('ViewRenderer'); +$viewRenderer = \Zend\Controller\Action\HelperBroker::getStaticHelper('ViewRenderer'); \Zend\Registry::set('router', $router); \Zend\Registry::set('dispatcher', $dispatcher); \Zend\Registry::set('plugin', $plugin); From 18a4fcbf8e15d30f44ad2ff166f2946490f7b7e7 Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Fri, 2 Jul 2010 09:21:54 -0400 Subject: [PATCH 2/3] Zend\DB cleanup - Moved all subcomponents that consisted of a class and exception up one level - Consistency in interface and abstract class naming - updated all tests and code to reflect changes --- test/PHPUnit/Db/DataSet/DbRowsetTest.php | 6 +++--- test/PHPUnit/Db/DataSet/QueryDataSetTest.php | 4 ++-- test/PHPUnit/Db/TestCaseTest.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/PHPUnit/Db/DataSet/DbRowsetTest.php b/test/PHPUnit/Db/DataSet/DbRowsetTest.php index 410514fe79..9355b9d624 100644 --- a/test/PHPUnit/Db/DataSet/DbRowsetTest.php +++ b/test/PHPUnit/Db/DataSet/DbRowsetTest.php @@ -42,7 +42,7 @@ protected function getRowSet() 'rowClass' => 'stdClass', 'data' => array(array('foo' => 'bar'), array('foo' => 'baz')), ); - $rowset = new \Zend\DB\Table\Rowset\Rowset($config); + $rowset = new \Zend\DB\Table\Rowset($config); return $rowset; } @@ -68,7 +68,7 @@ public function testRowset_ConstructWithDisconnectedRowset_NoTableName_ThrowsExc { $this->setExpectedException("Zend\Test\PHPUnit\Db\Exception"); - $rowset = $this->getMock('Zend\Db\Table\Rowset\AbstractRowset', array(), array(), '', false); + $rowset = $this->getMock('Zend\Db\Table\AbstractRowset', array(), array(), '', false); $rowset->expects($this->once()) ->method('getTable') ->will($this->returnValue(null)); @@ -86,7 +86,7 @@ public function testRowset_WithNoRows_GetColumnsFromTable() ->with($this->equalTo('cols')) ->will($this->returnValue($columns)); - $rowset = $this->getMock('Zend\Db\Table\Rowset\AbstractRowset', array(), array(), '', false); + $rowset = $this->getMock('Zend\Db\Table\AbstractRowset', array(), array(), '', false); $rowset->expects($this->exactly(2)) ->method('getTable') ->will($this->returnValue($tableMock)); diff --git a/test/PHPUnit/Db/DataSet/QueryDataSetTest.php b/test/PHPUnit/Db/DataSet/QueryDataSetTest.php index 7bd2c4b87d..793f03e79b 100644 --- a/test/PHPUnit/Db/DataSet/QueryDataSetTest.php +++ b/test/PHPUnit/Db/DataSet/QueryDataSetTest.php @@ -54,7 +54,7 @@ public function testAddTableWithoutQueryParameterCreatesSelectWildcardAll() $fixtureTableName = "foo"; $adapterMock = $this->getMock('Zend\Test\DbAdapter'); - $selectMock = $this->getMock('Zend\DB\Select\Select', array(), array($adapterMock)); + $selectMock = $this->getMock('Zend\DB\Select', array(), array($adapterMock)); $adapterMock->expects($this->once()) ->method('select') @@ -63,7 +63,7 @@ public function testAddTableWithoutQueryParameterCreatesSelectWildcardAll() $selectMock->expects($this->once()) ->method('from') - ->with($fixtureTableName, \Zend\DB\Select\Select::SQL_WILDCARD); + ->with($fixtureTableName, \Zend\DB\Select::SQL_WILDCARD); $selectMock->expects($this->once()) ->method('__toString') ->will($this->returnValue('SELECT * FOM foo')); diff --git a/test/PHPUnit/Db/TestCaseTest.php b/test/PHPUnit/Db/TestCaseTest.php index 2dcd899191..dfbd215cd4 100644 --- a/test/PHPUnit/Db/TestCaseTest.php +++ b/test/PHPUnit/Db/TestCaseTest.php @@ -99,7 +99,7 @@ public function testCreateDbTableConvenienceMethodReturnType() public function testCreateDbRowsetConvenienceMethodReturnType() { - $mock = $this->getMock('Zend\DB\Table\Rowset\Rowset', array(), array(array())); + $mock = $this->getMock('Zend\DB\Table\Rowset', array(), array(array())); $mock->expects($this->once())->method('toArray')->will($this->returnValue(array("foo" => 1, "bar" => 1))); $rowset = $this->createDbRowset($mock, "fooTable"); From 35353801738ec0e150f6f3830268b7d666ef97fe Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Sat, 3 Jul 2010 10:03:14 -0400 Subject: [PATCH 3/3] Zend\DB cleanup - Moved all interfaces up a level - Flattened Zend\DB\Table class hierarchy - Cleaned up "orphaned" subcomponents - If they consisted of a class and an exception, moved them up a level - Updated dependent code to reflect the above changes --- src/DbAdapter.php | 2 +- src/DbStatement.php | 4 ++-- src/PHPUnit/DatabaseTestCase.php | 4 ++-- src/PHPUnit/Db/DataSet/DbRowset.php | 6 +++--- src/PHPUnit/Db/DataSet/DbTable.php | 4 ++-- src/PHPUnit/Db/DataSet/DbTableDataSet.php | 2 +- src/PHPUnit/Db/DataSet/QueryDataSet.php | 8 ++++---- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/DbAdapter.php b/src/DbAdapter.php index df26780265..f3481c47d6 100644 --- a/src/DbAdapter.php +++ b/src/DbAdapter.php @@ -222,7 +222,7 @@ public function closeConnection() /** * Prepare a statement and return a PDOStatement-like object. * - * @param string|\Zend\DB\Select\Select $sql SQL query + * @param string|\Zend\DB\Select $sql SQL query * @return Zend_Db_Statment|PDOStatement */ public function prepare($sql) diff --git a/src/DbStatement.php b/src/DbStatement.php index 532f1cab07..35f6d5e4b2 100644 --- a/src/DbStatement.php +++ b/src/DbStatement.php @@ -30,14 +30,14 @@ * Testing Database Statement that acts as a stack to SQL resultsets. * * @uses \Zend\DB\Statement\Exception - * @uses \Zend\DB\Statement\StatementInterface + * @uses \Zend\DB\Statement * @category Zend * @package Zend_Test * @subpackage PHPUnit * @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 DbStatement implements Statement\StatementInterface +class DbStatement implements Statement { /** * @var array diff --git a/src/PHPUnit/DatabaseTestCase.php b/src/PHPUnit/DatabaseTestCase.php index 640ced926a..7d71dc850c 100644 --- a/src/PHPUnit/DatabaseTestCase.php +++ b/src/PHPUnit/DatabaseTestCase.php @@ -122,11 +122,11 @@ protected function createDbTable(\Zend\DB\Table\AbstractTable $table, $where=nul /** * Create a data table based on a Zend_Db_Table_Rowset instance * - * @param \Zend\DB\Table\Rowset\AbstractRowset $rowset + * @param \Zend\DB\Table\AbstractRowset $rowset * @param string * @return \Zend\Test\PHPUnit\Db\DataSet\DbRowset */ - protected function createDbRowset(\Zend\DB\Table\Rowset\AbstractRowset $rowset, $tableName = null) + protected function createDbRowset(\Zend\DB\Table\AbstractRowset $rowset, $tableName = null) { return new Db\DataSet\DbRowset($rowset, $tableName); } diff --git a/src/PHPUnit/Db/DataSet/DbRowset.php b/src/PHPUnit/Db/DataSet/DbRowset.php index bce43775c5..6beb6adfc7 100644 --- a/src/PHPUnit/Db/DataSet/DbRowset.php +++ b/src/PHPUnit/Db/DataSet/DbRowset.php @@ -30,7 +30,7 @@ * * @uses PHPUnit_Extensions_Database_DataSet_AbstractTable * @uses PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData - * @uses \Zend\DB\Table\Rowset\AbstractRowset + * @uses \Zend\DB\Table\AbstractRowset * @uses \Zend\Test\PHPUnit\Db\Exception * @category Zend * @package Zend_Test @@ -43,10 +43,10 @@ class DbRowset extends \PHPUnit_Extensions_Database_DataSet_AbstractTable /** * Construct Table object from a Zend_Db_Table_Rowset * - * @param \Zend\DB\Table\Rowset\AbstractRowset $rowset + * @param \Zend\DB\Table\AbstractRowset $rowset * @param string $tableName */ - public function __construct(\Zend\DB\Table\Rowset\AbstractRowset $rowset, $tableName = null) + public function __construct(\Zend\DB\Table\AbstractRowset $rowset, $tableName = null) { if($tableName == null) { $table = $rowset->getTable(); diff --git a/src/PHPUnit/Db/DataSet/DbTable.php b/src/PHPUnit/Db/DataSet/DbTable.php index d7b0181d72..2f4c380851 100644 --- a/src/PHPUnit/Db/DataSet/DbTable.php +++ b/src/PHPUnit/Db/DataSet/DbTable.php @@ -75,7 +75,7 @@ class DbTable extends \PHPUnit_Extensions_Database_DataSet_QueryTable * Construct Dataset Table from Zend_Db_Table object * * @param \Zend\DB\Table\AbstractTable $table - * @param string|\Zend\DB\Select\Select|null $where + * @param string|\Zend\DB\Select|null $where * @param string|null $order * @param int $count * @param int $offset @@ -103,7 +103,7 @@ protected function loadData() $this->data = $this->_table->fetchAll( $this->_where, $this->_order, $this->_count, $this->_offset ); - if($this->data instanceof \Zend\DB\Table\Rowset\AbstractRowset) { + if($this->data instanceof \Zend\DB\Table\AbstractRowset) { $this->data = $this->data->toArray(); } } diff --git a/src/PHPUnit/Db/DataSet/DbTableDataSet.php b/src/PHPUnit/Db/DataSet/DbTableDataSet.php index da349c706a..e3280a5943 100644 --- a/src/PHPUnit/Db/DataSet/DbTableDataSet.php +++ b/src/PHPUnit/Db/DataSet/DbTableDataSet.php @@ -52,7 +52,7 @@ class DbTableDataSet extends \PHPUnit_Extensions_Database_DataSet_AbstractDataSe * By default a select * will be done on the given tablename. * * @param \Zend\DB\Table\AbstractTable $table - * @param string|\Zend\DB\Select\Select $query + * @param string|\Zend\DB\Select $query * @param string $where * @param string $order * @param string $count diff --git a/src/PHPUnit/Db/DataSet/QueryDataSet.php b/src/PHPUnit/Db/DataSet/QueryDataSet.php index 9d7698b044..56e45f1b26 100644 --- a/src/PHPUnit/Db/DataSet/QueryDataSet.php +++ b/src/PHPUnit/Db/DataSet/QueryDataSet.php @@ -31,7 +31,7 @@ * * @uses PHPUnit_Extensions_Database_DataSet_QueryDataSet * @uses PHPUnit_Extensions_Database_DB_IDatabaseConnection - * @uses \Zend\DB\Select\Select + * @uses \Zend\DB\Select * @uses \Zend\Test\PHPUnit\Db\DataSet\QueryTable * @uses \Zend\Test\PHPUnit\Db\Exception * @category Zend @@ -61,16 +61,16 @@ public function __construct(\PHPUnit_Extensions_Database_DB_IDatabaseConnection * By default a select * will be done on the given tablename. * * @param string $tableName - * @param string|\Zend\DB\Select\Select $query + * @param string|\Zend\DB\Select $query */ public function addTable($tableName, $query = \NULL) { if ($query === NULL) { $query = $this->databaseConnection->getConnection()->select(); - $query->from($tableName, Select\Select::SQL_WILDCARD); + $query->from($tableName, Select::SQL_WILDCARD); } - if($query instanceof Select\Select) { + if($query instanceof Select) { $query = $query->__toString(); }