diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-19 13:20:54 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-04-19 13:21:11 +0200 |
commit | 517e4ca5435106ab5304849248cbea4e9dffd4b0 (patch) | |
tree | 0f00076f012791b39c710994f695abf723546062 /tests/integration/db | |
parent | bd35b98d2c130f058b182f726636ee971625823b (diff) |
split up api class for easier testing and clearer code
Diffstat (limited to 'tests/integration/db')
-rw-r--r-- | tests/integration/db/ItemMapperIntegrationTest.php | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/tests/integration/db/ItemMapperIntegrationTest.php b/tests/integration/db/ItemMapperIntegrationTest.php deleted file mode 100644 index 186dca14f..000000000 --- a/tests/integration/db/ItemMapperIntegrationTest.php +++ /dev/null @@ -1,81 +0,0 @@ -<?php - -/** -* ownCloud - News -* -* @author Alessandro Cosentino -* @author Bernhard Posselt -* @copyright 2012 Alessandro Cosentino cosenal@gmail.com -* @copyright 2012 Bernhard Posselt dev@bernhard-posselt.com -* -* This library is free software; you can redistribute it and/or -* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE -* License as published by the Free Software Foundation; either -* version 3 of the License, or any later version. -* -* This library 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 AFFERO GENERAL PUBLIC LICENSE for more details. -* -* You should have received a copy of the GNU Affero General Public -* License along with this library. If not, see <http://www.gnu.org/licenses/>. -* -*/ - -namespace OCA\News\Db; - -use \OCA\News\Utility\MapperTestUtility; - -require_once(__DIR__ . "/../../classloader.php"); - - -class InMemoryDatabase { - - private $db; - - public function __construct(){ - $this->db = new \PDO('sqlite::memory:'); - } - - - public function prepare($sql){ - $count = 1; - $sql = str_replace('*PREFIX*', 'oc', $sql, $count); - var_dump($this->db->prepare($sql)); - return $this->db->prepare($sql); - } - - -} - - - -class ItemMapperIntegrationTest extends MapperTestUtility { - - protected $api; - - private $mapper; - private $db; - - protected function setUp(){ - $db = new InMemoryDatabase(); - $prepare = function($sql) use ($db){ - return $db->prepare($sql); - }; - - $this->api = $this->getMock('OCA\News\Core\API', - array('prepareQuery', 'getInsertId'), array('news')); - $this->api->expects($this->any()) - ->method('prepareQuery') - ->will($this->returnCallback($prepare)); - $this->mapper = new ItemMapper($this->api); - } - - - public function testFind(){ - //$this->mapper->find(3, 'john'); - } - - -}
\ No newline at end of file |