EXTMVC:
authorJochen Rau <j.rau@web.de>
Tue, 24 Mar 2009 21:50:36 +0000 (21:50 +0000)
committerJochen Rau <j.rau@web.de>
Tue, 24 Mar 2009 21:50:36 +0000 (21:50 +0000)
* Added test case for the ORM (Christopher Hlubek)
* Moved generic find() to ORM (Christopher Hlubek)
* Added methods to set, get, and send headers an content to the response (Jochen Rau)

typo3/sysext/extbase/Classes/DomainObject/AbstractDomainObject.php
typo3/sysext/extbase/Classes/Persistence/Mapper/ObjectRelationalMapper.php
typo3/sysext/extbase/Classes/Persistence/Repository.php
typo3/sysext/extbase/Classes/Persistence/Repository.php.orig [deleted file]
typo3/sysext/extbase/Classes/View/Helper/ForHelper.php
typo3/sysext/extbase/Classes/Web/Response.php
typo3/sysext/extbase/Documentation/todo.txt
typo3/sysext/extbase/Tests/ObjectRelationalMapper_testcase.php [new file with mode: 0644]
typo3/sysext/extbase/Tests/Repository_testcase.php

index 8f7f405..f7936b3 100644 (file)
@@ -95,8 +95,6 @@ abstract class TX_EXTMVC_DomainObject_AbstractDomainObject implements TX_EXTMVC_
        public function _reconstituteProperty($propertyName, $value) {
                if (property_exists($this, $propertyName)) {
                        $this->$propertyName = $value;
-               } else {
-                       // TODO Should we throw new TX_EXTMVC_Persistence_Exception_UnknownProperty('The property "' . $propertyName . '" doesn\'t exist in this object.', 1233270476);
                }
        }
 
index 404eeaf..947c13f 100644 (file)
@@ -56,6 +56,49 @@ class TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Singl
                $this->persistenceSession = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Session');
                $GLOBALS['TSFE']->includeTCA();
        }
+       
+       /**
+        * @see Repository#find(...)
+        */
+       public function find($className, $conditions = '', $groupBy = '', $orderBy = '', $limit = '', $useEnableFields = TRUE) {
+               if (is_array($conditions)) {
+                       $whereParts = array();
+                       foreach ($conditions as $key => $condition) {
+                               if (is_array($condition) && isset($condition[0])) {
+                                       $sql = $condition[0];
+                                       for ($i = 1; $i < count($condition); $i++) {
+                                               $markPos = strpos($sql, '?');
+                                               if ($markPos !== FALSE) {
+                                                       $sql = substr($sql, 0, $markPos) . $this->convertValueToQueryParameter($condition[$i]) . substr($sql, $markPos + 1);
+                                               }
+                                       }
+                                       $whereParts[] = '(' . $sql . ')';
+                               } elseif (is_string($key)) {
+                                       if (!is_array($condition)) {
+                                               $column = $this->getDataMap($className)->getColumnMap($key)->getColumnName();
+                                               $sql = $column . ' = ' . $this->convertValueToQueryParameter($condition);
+                                       }
+                                       $whereParts[] = '(' . $sql . ')';
+                               }
+                       }
+                       $where = implode(' AND ', $whereParts);
+               } elseif (is_string($conditions)) {
+                       $where = $conditions;
+               }
+               return $this->fetch($className, $where, $groupBy, $orderBy, $limit, $useEnableFields);
+       }
+
+       protected function convertValueToQueryParameter($value) {
+               if (is_bool($value)) {
+                       $parameter = $value ? 1 : 0;
+               } elseif ($value instanceof TX_EXTMVC_DomainObject_AbstractDomainObject) {
+                       $parameter = $value->getUid();
+               } else {
+                       $parameter = (string)$value;
+               }
+               return $GLOBALS['TYPO3_DB']->fullQuoteStr($parameter, '');
+       }
+
 
        /**
         * Fetches rows from the database by given SQL statement snippets
index 4789b72..7ba599d 100644 (file)
@@ -150,48 +150,9 @@ abstract class TX_EXTMVC_Persistence_Repository implements TX_EXTMVC_Persistence
         * @param string $limit Limit SQL part
         * @param bool $useEnableFields Wether to automatically restrict the query by enable fields
         * @return array An array of objects, empty if no objects found
-        *
-        * @todo implement support for SQL LIMIT
         */
-       public function find($conditions = '', $groupBy = '', $orderBy = '', $limit = '', $useEnableFields = TRUE) {
-               if (is_array($conditions)) {
-                       $whereParts = array();
-                       foreach ($conditions as $key => $condition) {
-                               if (is_array($condition) && isset($condition[0])) {
-                                       $sql = $condition[0];
-                                       for ($i = 1; $i < count($condition); $i++) {
-                                               $markPos = strpos($sql, '?');
-                                               if ($markPos !== FALSE) {
-                                                       $sql = substr($sql, 0, $markPos) . $this->convertValueToQueryParameter($condition[$i]) . substr($sql, $markPos + 1);
-                                               }
-                                       }
-                                       $whereParts[] = '(' . $sql . ')';
-                               } elseif (is_string($key)) {
-                                       if (!is_array($condition)) {
-                                               // TODO substitute key with column name
-                                               $column = $this->dataMapper->getDataMap($this->aggregateRootClassName)->getColumnMap($key)->getPropertyName();
-                                               $sql = $column . ' = ' . $this->convertValueToQueryParameter($condition);
-                                       }
-                                       $whereParts[] = '(' . $sql . ')';
-                               }
-                       }
-                       $where = implode(' AND ', $whereParts);
-               } elseif (is_string($conditions)) {
-                       $where = $conditions;
-               }
-               
-               return $this->dataMapper->fetch($this->aggregateRootClassName, $where, $groupBy, $orderBy, $limit, $useEnableFields);
-       }
-
-       protected function convertValueToQueryParameter($value) {
-               if (is_bool($value)) {
-                       $parameter = $value ? 1 : 0;
-               } elseif ($value instanceof TX_EXTMVC_DomainObject_AbstractDomainObject) {
-                       $parameter = $value->getUid();
-               } else {
-                       $parameter = (string)$value;
-               }
-               return $GLOBALS['TYPO3_DB']->fullQuoteStr($parameter, '');
+       public function find($conditions = '', $groupBy = '', $orderBy = '', $limit = '', $useEnableFields = TRUE) {            
+               return $this->dataMapper->find($this->aggregateRootClassName, $conditions, $groupBy, $orderBy, $limit, $useEnableFields);
        }
 
        /**
diff --git a/typo3/sysext/extbase/Classes/Persistence/Repository.php.orig b/typo3/sysext/extbase/Classes/Persistence/Repository.php.orig
deleted file mode 100644 (file)
index 4838bba..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-/***************************************************************
-*  Copyright notice
-*
-*  (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
-*  All rights reserved
-*
-*  This script is part of the TYPO3 project. The TYPO3 project is
-*  free software; you can redistribute it and/or modify
-*  it under the terms of the GNU General Public License as published by
-*  the Free Software Foundation; either version 2 of the License, or
-*  (at your option) any later version.
-*
-*  The GNU General Public License can be found at
-*  http://www.gnu.org/copyleft/gpl.html.
-*
-*  This script is distributed in the hope that it will be useful,
-*  but WITHOUT ANY WARRANTY; without even the implied warranty of
-*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-*  GNU General Public License for more details.
-*
-*  This copyright notice MUST APPEAR in all copies of the script!
-***************************************************************/
-
-require_once(PATH_t3lib . 'interfaces/interface.t3lib_singleton.php');
-require_once(PATH_tslib . 'class.tslib_content.php');
-
-/**
- * The base repository - will usually be extended by a more concrete repository.
- *
- * @package TYPO3
- * @subpackage extmvc
- * @version $ID:$
- */
-abstract class TX_EXTMVC_Persistence_Repository implements TX_EXTMVC_Persistence_RepositoryInterface, t3lib_Singleton {
-
-       /**
-        * Class Name of the aggregate root
-        *
-        * @var string
-        */
-       protected $aggregateRootClassName;
-
-       /**
-        * Objects of this repository
-        *
-        * @var TX_EXTMVC_Persistence_ObjectStorage
-        */
-       protected $objects;
-
-       /**
-        * Contains the persistence session of the current extension
-        *
-        * @var TX_EXTMVC_Persistence_Session
-        */
-       protected $persistenceSession;
-
-       /**
-        * Constructs a new Repository
-        *
-        */
-       public function __construct() {
-               $this->objects = new TX_EXTMVC_Persistence_ObjectStorage();
-               $repositoryClassName = get_class($this);
-               if (substr($repositoryClassName, -10) == 'Repository' && substr($repositoryClassName, -11, 1) != '_') {
-                       $this->aggregateRootClassName = substr($repositoryClassName, 0, -10);
-               }
-               if (empty($this->aggregateRootClassName)) {
-                       throw new TX_EXTMVC_Exception('The domain repository wasn\'t able to resolve the aggregate root class to manage.', 1237897039);
-               }
-               if (!in_array('TX_EXTMVC_DomainObject_DomainObjectInterface', class_implements($this->aggregateRootClassName))) {
-                       throw new TX_EXTMVC_Exception('The domain repository tried to manage objects which are not implementing the TX_EXTMVC_DomainObject_DomainObjectInterface.', 1237897039);
-               }
-               $this->dataMapper = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper'); // singleton
-               $this->persistenceSession = t3lib_div::makeInstance('TX_EXTMVC_Persistence_Session'); // singleton
-               $this->persistenceSession->registerAggregateRootClassName($this->aggregateRootClassName);
-       }
-
-       /**
-        * Adds an object to this repository
-        *
-        * @param object $object The object to add
-        * @return void
-        */
-       public function add($object) {
-               if (!($object instanceof $this->aggregateRootClassName)) throw new TX_EXTMVC_Persistence_Exception_InvalidClass('The class "' . get_class($object) . '" is not supported by the repository.');
-               $this->objects->attach($object);
-               $this->persistenceSession->registerAddedObject($object);
-       }
-
-       /**
-        * Removes an object from this repository.
-        *
-        * @param object $object The object to remove
-        * @return void
-        */
-       public function remove($object) {
-               if (!($object instanceof $this->aggregateRootClassName)) throw new TX_EXTMVC_Persistence_Exception_InvalidClass('The class "' . get_class($object) . '" is not supported by the repository.');
-               $this->objects->detach($object);
-               $this->persistenceSession->registerRemovedObject($object);
-       }
-
-       /**
-        * Dispatches magic methods (findBy[Property]())
-        *
-        * @param string $methodName The name of the magic method
-        * @param string $arguments The arguments of the magic method
-        * @throws TX_EXTMVC_Persistence_Exception_UnsupportedMethod
-        * @return void
-        */
-       public function __call($methodName, $arguments) {
-               if (substr($methodName, 0, 6) === 'findBy' && strlen($methodName) > 7) {
-                       $propertyName = TX_EXTMVC_Utility_Strings::lowercaseFirst(substr($methodName,6));
-                       return $this->findByProperty($propertyName, $arguments[0]);
-               } elseif (substr($methodName, 0, 9) === 'findOneBy' && strlen($methodName) > 10) {
-                       $propertyName = TX_EXTMVC_Utility_Strings::lowercaseFirst(substr($methodName,9));
-                       $result = $this->findByProperty($propertyName, $arguments[0]);
-                       if (empty($result)) {
-                               return FALSE;
-                       } else {
-                               return $result[0]; // TODO Implement LIMIT
-                       }
-               }
-               throw new TX_EXTMVC_Persistence_Exception_UnsupportedMethod('The method "' . $methodName . '" is not supported by the repository.', 1233180480);
-       }
-
-       /**
-        * Returns all objects of this repository
-        *
-        * @return array An array of objects, empty if no objects found
-        */
-       public function findAll() {
-               return $this->findWhere($this->aggregateRootClassName);
-       }
-
-       /**
-        * Finds objects matching 'property=xyz'
-        *
-        * @param string $propertyName The name of the property (will be checked by a white list)
-        * @param string $arguments The arguments of the magic findBy method
-        * @return array The result
-        */
-       protected function findByProperty($propertyName, $value) {
-               // TODO implement support for SQL LIMIT
-               if ($value instanceof TX_EXTMVC_DomainObject_AbstractDomainObject) {
-                       $where = $propertyName . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value->getUid(), '');
-               } else {
-                       $where = $propertyName . '=' . $GLOBALS['TYPO3_DB']->fullQuoteStr($value, '');
-               }
-               return $this->findWhere($this->aggregateRootClassName, $where);
-       }
-
-       /**
-        * A generic find where method
-        *
-        * @param string $className The class name
-        * @param string $arguments The WHERE statement
-        * @return void
-        */
-       public function findWhere($className, $where = '1=1', $groupBy = '', $orderBy = '', $limit = '', $useEnableFields = TRUE) {
-               // TODO check for aggregateRootclassName
-               return $this->dataMapper->fetch($className, $where, $groupBy, $orderBy, $limit);
-       }
-
-}
-?>
\ No newline at end of file
index e37ced1..594eb23 100644 (file)
@@ -34,7 +34,7 @@ class TX_EXTMVC_View_Helper_ForHelper extends TX_EXTMVC_View_Helper_AbstractHelp
        public function render($view, $arguments, $templateSource, $variables) {
                if (is_array($arguments['each'])) {
                        foreach ($arguments['each'] as $singleElement) {
-                               $variables[TX_EXTMVC_Utility_Strings::underscoredToUpperCamelCase($arguments['as'])] = $singleElement; // FIXME strtolower
+                               $variables[TX_EXTMVC_Utility_Strings::underscoredToUpperCamelCase($arguments['as'])] = $singleElement;
                                $newContent .= $view->renderTemplate($templateSource, $variables);
                        }
                }
index a906742..e8f2ff9 100755 (executable)
@@ -130,6 +130,67 @@ class TX_EXTMVC_Web_Response extends TX_EXTMVC_Response {
        public function getStatus() {
                return $this->statusCode . ' ' . $this->statusMessage;
        }
+       
+       /**
+        * Sets the specified HTTP header
+        *
+        * @param string $name Name of the header, for example "Location", "Content-Description" etc.
+        * @param mixed $value The value of the given header
+        * @param boolean $replaceExistingHeader If a header with the same name should be replaced. Default is TRUE.
+        * @return void
+        */
+       public function setHeader($name, $value, $replaceExistingHeader = TRUE) {
+               if (strtoupper(substr($name, 0, 4)) === 'HTTP') throw new InvalidArgumentException('The HTTP status header must be set via setStatus().', 1220541963);
+               if ($replaceExistingHeader === TRUE || !isset($this->headers[$name])) {
+                       $this->headers[$name] = array($value);
+               } else {
+                       $this->headers[$name][] = $value;
+               }
+       }
+       
+       /**
+        * Returns the HTTP headers - including the status header - of this web response
+        *
+        * @return string The HTTP headers
+        */
+       public function getHeaders() {
+               $preparedHeaders = array();
+               $statusHeader = 'HTTP/1.1 ' . $this->statusCode . ' ' . $this->statusMessage;
+
+               $preparedHeaders[] = $statusHeader;
+               foreach ($this->headers as $name => $values) {
+                       foreach ($values as $value) {
+                               $preparedHeaders[] = $name . ': ' . $value;
+                       }
+               }
+               return $preparedHeaders;
+       }
+
+       /**
+        * Sends the HTTP headers.
+        *
+        * If headers have already been sent, this method fails silently.
+        *
+        * @return void
+        */
+       public function sendHeaders() {
+               if (headers_sent() === TRUE) return;
+               foreach ($this->getHeaders() as $header) {
+                       header($header);
+               }
+       }
+
+       /**
+        * Renders and sends the whole web response
+        *
+        * @return void
+        */
+       public function send() {
+               $this->sendHeaders();
+               if ($this->content !== NULL) {
+                       echo $this->getContent();
+               }
+       }
 
        /**
         * Adds an additional header data (something like
index 6766a4a..e80e8fb 100644 (file)
@@ -10,8 +10,8 @@
 
        • Make MVC work with the new autoloader of 4.3
        • RealURL testing
-       • Directory "Classes/Web" -> should be "Classes/Controller/Web"??
-       • Persistence_Session->clear() .... ->removeAll() should be replaced by "new SPLObjectStorage"
+       • [DONE] Directory "Classes/Web" -> should be "Classes/Controller/Web"?? -> JR: I dont't think so 
+       • [DONE] Persistence_Session->clear() .... ->removeAll() should be replaced by "new SPLObjectStorage"
        • Documentation: Document the _stuff (CGL!!)
        • Naming (CGL!!)
        • [DONE] AbstractDomainObject -- "cleanProperties" should be renamed to "_cleanProperties"
@@ -22,7 +22,7 @@
        • [DONE] Persistence_Repository->findOne() REMOVE
        • [-> 4.4] Query Object support? (Jan-Erik Revsbech)
        • [DONE] Persistence_Repository->findWhere() -- add enableFields by default (but make it possible to switch it of)
-       • Persistence_Mapper_DataMap -- implement "aliasing" (Use case: Long name -> tx_twitter_something_twitter -> "twitter", so you can say "findByTwitterName" )
+       • Persistence_Mapper_DataMap -- implement "aliasing" (Use case: Long name -> tx_twitter_something_twitter -> "twitterName", so you can say "findByTwitterName" )
        • Persistence_Mapper_DataMap -- tstamp is not needed, same for cruser_id
        • Persistence_Mapper_DataMap->setTypeOfValue  -- we need to explode stuff and not use strpos
        • Persistence_Mapper_DataMap -- check with IRRE (Olly)
diff --git a/typo3/sysext/extbase/Tests/ObjectRelationalMapper_testcase.php b/typo3/sysext/extbase/Tests/ObjectRelationalMapper_testcase.php
new file mode 100644 (file)
index 0000000..1aedc93
--- /dev/null
@@ -0,0 +1,115 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Christopher Hlubek <hlubek@networkteam.com>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+require_once('Base_testcase.php');
+
+class TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper_testcase extends TX_EXTMVC_Base_testcase {
+
+       public function setUp() {
+               $GLOBALS['TSFE'] = $this->getMock('tslib_fe', array('includeTCA'));
+               $GLOBALS['TSFE']->expects($this->any())
+                       ->method('includeTCA')
+                       ->will($this->returnValue(NULL));
+               
+               $GLOBALS['TYPO3_DB'] = $this->getMock('tslib_DB', array('fullQuoteStr'));
+       }
+
+       public function test_FindByConditionWithPlaceholders() {
+               $mapper = $this->getMock('TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper', array('fetch'));
+               $mapper->expects($this->once())
+                       ->method('fetch')
+                       ->with($this->equalTo('TX_Blogexample_Domain_Blog'), $this->equalTo('(name LIKE "foo" OR name LIKE "bar") AND (hidden = 0)'));
+               
+               $GLOBALS['TYPO3_DB']->expects($this->at(0))
+                       ->method('fullQuoteStr')
+                       ->with($this->equalTo('foo'))
+                       ->will($this->returnValue('"foo"'));
+
+               $GLOBALS['TYPO3_DB']->expects($this->at(1))
+                       ->method('fullQuoteStr')
+                       ->with($this->equalTo('bar'))
+                       ->will($this->returnValue('"bar"'));
+
+               $GLOBALS['TYPO3_DB']->expects($this->at(2))
+                       ->method('fullQuoteStr')
+                       ->with($this->equalTo('0'))
+                       ->will($this->returnValue('0'));
+               
+               $mapper->find('TX_Blogexample_Domain_Blog',
+                       array(
+                               array('name LIKE ? OR name LIKE ?', 'foo', 'bar'),
+                               array('hidden = ?', FALSE)
+                       ));
+       }
+
+       public function test_FindByConditionWithExample() {
+               $mapper = $this->getMock('TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper', array('fetch', 'getDataMap'));
+               $mapper->expects($this->once())
+                       ->method('fetch')
+                       ->with($this->equalTo('TX_Blogexample_Domain_Blog'), $this->equalTo('(blog_name = "foo") AND (hidden = 0)'));
+
+               $columnMap1 = $this->getMock('TX_EXTMVC_Persistence_Mapper_ColumnMap', array('getColumnName'), array(), '', FALSE);
+               $columnMap1->expects($this->once())
+                       ->method('getColumnName')
+                       ->will($this->returnValue('blog_name'));
+
+               $columnMap2 = $this->getMock('TX_EXTMVC_Persistence_Mapper_ColumnMap', array('getColumnName'), array(), '', FALSE);
+               $columnMap2->expects($this->once())
+                       ->method('getColumnName')
+                       ->will($this->returnValue('hidden'));
+
+               $dataMap = $this->getMock('TX_EXTMVC_Persistence_Mapper_DataMap', array('getColumnMap'), array(), '', FALSE);
+               $dataMap->expects($this->at(0))
+                       ->method('getColumnMap')
+                       ->with($this->equalTo('blogName'))
+                       ->will($this->returnValue($columnMap1));
+
+               $dataMap->expects($this->at(1))
+                       ->method('getColumnMap')
+                       ->with($this->equalTo('hidden'))
+                       ->will($this->returnValue($columnMap2));
+               
+               $mapper->expects($this->any())
+                       ->method('getDataMap')
+                       ->with($this->equalTo('TX_Blogexample_Domain_Blog'))
+                       ->will($this->returnValue($dataMap));
+               
+               $GLOBALS['TYPO3_DB']->expects($this->at(0))
+                       ->method('fullQuoteStr')
+                       ->with($this->equalTo('foo'))
+                       ->will($this->returnValue('"foo"'));
+
+               $GLOBALS['TYPO3_DB']->expects($this->at(1))
+                       ->method('fullQuoteStr')
+                       ->with($this->equalTo('0'))
+                       ->will($this->returnValue('0'));
+               
+               $mapper->find('TX_Blogexample_Domain_Blog',
+                       array(
+                               'blogName' => 'foo',
+                               'hidden' => FALSE
+                       ));
+       }
+}
+?>
\ No newline at end of file
index 5a074bc..3abfaad 100644 (file)
 require_once('Base_testcase.php');
 
 class TX_EXTMVC_Persistence_Repository_testcase extends TX_EXTMVC_Base_testcase {
-
-       public function __construct() {
-               require_once(t3lib_extMgm::extPath('blogexample') . 'Classes/Domain/BlogRepository.php');
-       }
-
-       public function setUp() {
-               $GLOBALS['TSFE'] = $this->getMock('tslib_fe', array('includeTCA'));
-               $GLOBALS['TSFE']->expects($this->any())
-                       ->method('includeTCA')
-                       ->will($this->returnValue(NULL));
-               
-               $GLOBALS['TYPO3_DB'] = $this->getMock('tslib_DB', array('fullQuoteStr'));
-       }
-
-       public function test_FindByConditionWithPlaceholders() {
-               $repository = new TX_Blogexample_Domain_BlogRepository();
-               $repository->dataMapper = $this->getMock('TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper', array('fetch'));
-               $repository->dataMapper->expects($this->once())
-                       ->method('fetch')
-                       ->with($this->equalTo('TX_Blogexample_Domain_Blog'), $this->equalTo('(name LIKE "foo" OR name LIKE "bar") AND (hidden = 0)'));
-               
-               $GLOBALS['TYPO3_DB']->expects($this->at(0))
-                       ->method('fullQuoteStr')
-                       ->with($this->equalTo('foo'))
-                       ->will($this->returnValue('"foo"'));
-
-               $GLOBALS['TYPO3_DB']->expects($this->at(1))
-                       ->method('fullQuoteStr')
-                       ->with($this->equalTo('bar'))
-                       ->will($this->returnValue('"bar"'));
-
-               $GLOBALS['TYPO3_DB']->expects($this->at(2))
-                       ->method('fullQuoteStr')
-                       ->with($this->equalTo('0'))
-                       ->will($this->returnValue('0'));
-               
-               $repository->find(array(
-                       array('name LIKE ? OR name LIKE ?', 'foo', 'bar'),
-                       array('hidden = ?', FALSE)
-                       ));
-       }
-
-       public function test_FindByConditionWithExample() {
-               $repository = new TX_Blogexample_Domain_BlogRepository();
-               $repository->dataMapper = $this->getMock('TX_EXTMVC_Persistence_Mapper_ObjectRelationalMapper', array('fetch'));
-               $repository->dataMapper->expects($this->once())
-                       ->method('fetch')
-                       ->with($this->equalTo('TX_Blogexample_Domain_Blog'), $this->equalTo('(blog_name = "foo") AND (hidden = 0)'));
-               
-               $GLOBALS['TYPO3_DB']->expects($this->at(0))
-                       ->method('fullQuoteStr')
-                       ->with($this->equalTo('foo'))
-                       ->will($this->returnValue('"foo"'));
-
-               $GLOBALS['TYPO3_DB']->expects($this->at(1))
-                       ->method('fullQuoteStr')
-                       ->with($this->equalTo('0'))
-                       ->will($this->returnValue('0'));
-               
-               $repository->find(array(
-                       'blogName' => 'foo',
-                       'hidden' => FALSE
-               ));
-       }
-       
        public function test_MagicFindByPropertyUsesGenericFind() {
                $repository = $this->getMock('TX_Blogexample_Domain_BlogRepository', array('find'), array('TX_Blogexample_Domain_Blog'));
                $repository->expects($this->once())