summaryrefslogtreecommitdiffstats
path: root/tests/Unit/Db
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Db')
-rw-r--r--tests/Unit/Db/FeedTest.php41
-rw-r--r--tests/Unit/Db/FolderMapperTest.php38
-rw-r--r--tests/Unit/Db/FolderTest.php29
-rw-r--r--tests/Unit/Db/ItemTest.php99
-rw-r--r--tests/Unit/Db/MapperFactoryTest.php63
-rw-r--r--tests/Unit/Db/MapperTestUtility.php120
6 files changed, 240 insertions, 150 deletions
diff --git a/tests/Unit/Db/FeedTest.php b/tests/Unit/Db/FeedTest.php
index 9b0c96f86..5e4e2a5a5 100644
--- a/tests/Unit/Db/FeedTest.php
+++ b/tests/Unit/Db/FeedTest.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Db;
@@ -16,10 +16,12 @@ namespace OCA\News\Tests\Unit\Db;
use OCA\News\Db\Feed;
-class FeedTest extends \PHPUnit_Framework_TestCase {
+class FeedTest extends \PHPUnit_Framework_TestCase
+{
- private function createFeed() {
+ private function createFeed()
+ {
$feed = new Feed();
$feed->setId(3);
$feed->setHttpLastModified(44);
@@ -43,10 +45,12 @@ class FeedTest extends \PHPUnit_Framework_TestCase {
return $feed;
}
- public function testToAPI() {
+ public function testToAPI()
+ {
$feed = $this->createFeed();
- $this->assertEquals([
+ $this->assertEquals(
+ [
'id' => 3,
'url' => 'http://google.com/some/weird/path',
'title' => 'title',
@@ -59,14 +63,17 @@ class FeedTest extends \PHPUnit_Framework_TestCase {
'link' => 'https://www.google.com/some/weird/path',
'updateErrorCount' => 2,
'lastUpdateError' => 'hi'
- ], $feed->toAPI());
+ ], $feed->toAPI()
+ );
}
- public function testSerialize() {
+ public function testSerialize()
+ {
$feed = $this->createFeed();
- $this->assertEquals([
+ $this->assertEquals(
+ [
'id' => 3,
'url' => 'http://google.com/some/weird/path',
'title' => 'title',
@@ -90,25 +97,29 @@ class FeedTest extends \PHPUnit_Framework_TestCase {
'lastUpdateError' => 'hi',
'basicAuthUser' => 'user',
'basicAuthPassword' => 'password'
- ], $feed->jsonSerialize());
+ ], $feed->jsonSerialize()
+ );
}
- public function testSetXSSUrl() {
+ public function testSetXSSUrl()
+ {
$feed = new Feed();
$feed->setUrl('javascript:alert()');
$this->assertEquals('', $feed->getUrl());
}
- public function testSetUrlUpdatesHash() {
+ public function testSetUrlUpdatesHash()
+ {
$feed = new Feed();
$feed->setUrl('http://test');
$this->assertEquals(md5('http://test'), $feed->getUrlHash());
}
- public function testSetXSSLink() {
+ public function testSetXSSLink()
+ {
$feed = new Feed();
$feed->setLink('javascript:alert()');
$this->assertEquals('', $feed->getLink());
diff --git a/tests/Unit/Db/FolderMapperTest.php b/tests/Unit/Db/FolderMapperTest.php
index 87b276d7c..bf7b1cae0 100644
--- a/tests/Unit/Db/FolderMapperTest.php
+++ b/tests/Unit/Db/FolderMapperTest.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Db;
@@ -43,7 +43,8 @@ class FolderMapperTest extends MapperTestUtility
}
- public function testFind(){
+ public function testFind()
+ {
$userId = 'john';
$id = 3;
$rows = [['id' => $this->folders[0]->getId()]];
@@ -59,7 +60,8 @@ class FolderMapperTest extends MapperTestUtility
}
- public function testFindNotFound(){
+ public function testFindNotFound()
+ {
$userId = 'john';
$id = 3;
$sql = 'SELECT * FROM `*PREFIX*news_folders` ' .
@@ -75,7 +77,8 @@ class FolderMapperTest extends MapperTestUtility
}
- public function testFindMoreThanOneResultFound(){
+ public function testFindMoreThanOneResultFound()
+ {
$userId = 'john';
$id = 3;
$rows = $this->twoRows;
@@ -93,7 +96,8 @@ class FolderMapperTest extends MapperTestUtility
- public function testFindAllFromUser(){
+ public function testFindAllFromUser()
+ {
$userId = 'john';
$rows = $this->twoRows;
$sql = 'SELECT * FROM `*PREFIX*news_folders` ' .
@@ -107,7 +111,8 @@ class FolderMapperTest extends MapperTestUtility
}
- public function testFindByName(){
+ public function testFindByName()
+ {
$folderName = 'heheh';
$userId = 'john';
$rows = $this->twoRows;
@@ -122,7 +127,8 @@ class FolderMapperTest extends MapperTestUtility
}
- public function testDelete(){
+ public function testDelete()
+ {
$folder = new Folder();
$folder->setId(3);
@@ -143,7 +149,8 @@ class FolderMapperTest extends MapperTestUtility
}
- public function testGetPurgeDeleted(){
+ public function testGetPurgeDeleted()
+ {
$rows = $this->twoRows;
$deleteOlderThan = 110;
$sql = 'SELECT * FROM `*PREFIX*news_folders` ' .
@@ -157,7 +164,8 @@ class FolderMapperTest extends MapperTestUtility
- public function testGetPurgeDeletedUser(){
+ public function testGetPurgeDeletedUser()
+ {
$rows = $this->twoRows;
$deleteOlderThan = 110;
$sql = 'SELECT * FROM `*PREFIX*news_folders` ' .
@@ -173,7 +181,8 @@ class FolderMapperTest extends MapperTestUtility
}
- public function testGetAllPurgeDeletedUser(){
+ public function testGetAllPurgeDeletedUser()
+ {
$rows = $this->twoRows;
$sql = 'SELECT * FROM `*PREFIX*news_folders` ' .
@@ -186,7 +195,8 @@ class FolderMapperTest extends MapperTestUtility
}
- public function testDeleteFromUser(){
+ public function testDeleteFromUser()
+ {
$userId = 'john';
$sql = 'DELETE FROM `*PREFIX*news_folders` WHERE `user_id` = ?';
diff --git a/tests/Unit/Db/FolderTest.php b/tests/Unit/Db/FolderTest.php
index 39352425e..4db59cef2 100644
--- a/tests/Unit/Db/FolderTest.php
+++ b/tests/Unit/Db/FolderTest.php
@@ -5,32 +5,37 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Db;
use OCA\News\Db\Folder;
-class FolderTest extends \PHPUnit_Framework_TestCase {
+class FolderTest extends \PHPUnit_Framework_TestCase
+{
- public function testToAPI() {
+ public function testToAPI()
+ {
$folder = new Folder();
$folder->setId(3);
$folder->setName('name');
- $this->assertEquals([
+ $this->assertEquals(
+ [
'id' => 3,
'name' => 'name'
- ], $folder->toAPI());
+ ], $folder->toAPI()
+ );
}
- public function testSerialize() {
+ public function testSerialize()
+ {
$folder = new Folder();
$folder->setId(3);
$folder->setName('john');
@@ -39,13 +44,15 @@ class FolderTest extends \PHPUnit_Framework_TestCase {
$folder->setOpened(true);
$folder->setDeletedAt(9);
- $this->assertEquals([
+ $this->assertEquals(
+ [
'id' => 3,
'parentId' => 4,
'name' => 'john',
'userId' => 'abc',
'opened' => true,
'deletedAt' => 9,
- ], $folder->jsonSerialize());
+ ], $folder->jsonSerialize()
+ );
}
} \ No newline at end of file
diff --git a/tests/Unit/Db/ItemTest.php b/tests/Unit/Db/ItemTest.php
index cceca4b8b..f86c2c8a9 100644
--- a/tests/Unit/Db/ItemTest.php
+++ b/tests/Unit/Db/ItemTest.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Db;
@@ -16,46 +16,55 @@ namespace OCA\News\Tests\Unit\Db;
use OCA\News\Db\Feed;
use OCA\News\Db\Item;
-class ItemTest extends \PHPUnit_Framework_TestCase {
+class ItemTest extends \PHPUnit_Framework_TestCase
+{
- /** @var Item */
+ /**
+ * @var Item
+ */
private $item;
- protected function setUp(){
+ protected function setUp()
+ {
$this->item = new Item();
$this->item->setStatus(0);
}
- public function testSetRead(){
+ public function testSetRead()
+ {
$this->item->setUnread(false);
$this->assertFalse($this->item->isUnread());
}
- public function testSetUnread(){
+ public function testSetUnread()
+ {
$this->item->setUnread(true);
$this->assertTrue($this->item->isUnread());
}
- public function testSetStarred(){
+ public function testSetStarred()
+ {
$this->item->setStarred(true);
$this->assertTrue($this->item->isStarred());
}
- public function testSetUnstarred(){
+ public function testSetUnstarred()
+ {
$this->item->setStarred(false);
$this->assertFalse($this->item->isStarred());
}
- public function testToAPI() {
+ public function testToAPI()
+ {
$item = new Item();
$item->setId(3);
$item->setGuid('guid');
@@ -77,7 +86,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
$item->setFingerprint('fingerprint');
$item->setContentHash('contentHash');
- $this->assertEquals([
+ $this->assertEquals(
+ [
'id' => 3,
'guid' => 'guid',
'guidHash' => 'hash',
@@ -96,11 +106,13 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
'rtl' => true,
'fingerprint' => 'fingerprint',
'contentHash' => 'contentHash'
- ], $item->toAPI());
+ ], $item->toAPI()
+ );
}
- public function testJSONSerialize() {
+ public function testJSONSerialize()
+ {
$item = new Item();
$item->setId(3);
$item->setGuid('guid');
@@ -121,7 +133,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
$item->setStarred(true);
$item->setLastModified(321);
- $this->assertEquals([
+ $this->assertEquals(
+ [
'id' => 3,
'guid' => 'guid',
'guidHash' => 'hash',
@@ -140,10 +153,12 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
'rtl' => true,
'intro' => 'this is a test',
'fingerprint' => 'fingerprint'
- ], $item->jsonSerialize());
+ ], $item->jsonSerialize()
+ );
}
- public function testToExport() {
+ public function testToExport()
+ {
$item = new Item();
$item->setId(3);
$item->setGuid('guid');
@@ -167,7 +182,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
$feed->setLink('http://test');
$feeds = ["feed1" => $feed];
- $this->assertEquals([
+ $this->assertEquals(
+ [
'guid' => 'guid',
'url' => 'https://google',
'title' => 'title',
@@ -181,11 +197,13 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
'starred' => true,
'feedLink' => 'http://test',
'rtl' => true
- ], $item->toExport($feeds));
+ ], $item->toExport($feeds)
+ );
}
- private function createImportItem($isRead) {
+ private function createImportItem($isRead)
+ {
$item = new Item();
$item->setGuid('guid');
$item->setGuidHash('guid');
@@ -210,7 +228,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
}
- public function testSearchIndex() {
+ public function testSearchIndex()
+ {
$item = new Item();
$item->setBody('<a>somEth&auml;ng</a>');
$item->setUrl('http://link');
@@ -222,7 +241,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
}
- public function testFromImport() {
+ public function testFromImport()
+ {
$item = $this->createImportItem(false);
$import = [
@@ -246,7 +266,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
}
- public function testFromImportRead() {
+ public function testFromImportRead()
+ {
$item = $this->createImportItem(true);
$import = [
@@ -271,7 +292,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
- public function testSetAuthor(){
+ public function testSetAuthor()
+ {
$item = new Item();
$item->setAuthor('<a>my link</li>');
$this->assertEquals('my link', $item->getAuthor());
@@ -279,7 +301,8 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
}
- public function testSetTitle(){
+ public function testSetTitle()
+ {
$item = new Item();
$item->setTitle('<a>my link</li>');
$this->assertEquals('my link', $item->getTitle());
@@ -287,28 +310,34 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
}
- public function testSetXSSUrl() {
+ public function testSetXSSUrl()
+ {
$item = new Item();
$item->setUrl('javascript:alert()');
$this->assertEquals('', $item->getUrl());
}
- public function testSetMagnetUrl() {
+ public function testSetMagnetUrl()
+ {
$item = new Item();
$item->setUrl('magnet://link.com');
$this->assertEquals('magnet://link.com', $item->getUrl());
}
- public function testMakeLinksInBodyOpenNewTab() {
+ public function testMakeLinksInBodyOpenNewTab()
+ {
$item = new Item();
$item->setBody("<a href=\"test\">ha</a>");
- $this->assertEquals("<a target=\"_blank\" rel=\"noreferrer\" href=\"test\">ha</a>",
- $item->getBody());
+ $this->assertEquals(
+ "<a target=\"_blank\" rel=\"noreferrer\" href=\"test\">ha</a>",
+ $item->getBody()
+ );
}
- public function testComputeFingerPrint() {
+ public function testComputeFingerPrint()
+ {
$title = 'a';
$body = 'b';
$url = 'http://google.com';
@@ -321,8 +350,10 @@ class ItemTest extends \PHPUnit_Framework_TestCase {
$item->setEnclosureLink($link);
$item->generateSearchIndex();
- $this->assertEquals(md5($title . $url . $body . $link),
- $item->getFingerprint());
+ $this->assertEquals(
+ md5($title . $url . $body . $link),
+ $item->getFingerprint()
+ );
}
}
diff --git a/tests/Unit/Db/MapperFactoryTest.php b/tests/Unit/Db/MapperFactoryTest.php
index f7c1ffa08..94a49f850 100644
--- a/tests/Unit/Db/MapperFactoryTest.php
+++ b/tests/Unit/Db/MapperFactoryTest.php
@@ -5,10 +5,10 @@
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
- * @author Alessandro Cosentino <cosenal@gmail.com>
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @copyright Alessandro Cosentino 2012
- * @copyright Bernhard Posselt 2012, 2014
+ * @author Alessandro Cosentino <cosenal@gmail.com>
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright 2012 Alessandro Cosentino
+ * @copyright 2012-2014 Bernhard Posselt
*/
namespace OCA\News\Tests\Unit\Db;
@@ -23,30 +23,35 @@ use OCP\IDBConnection;
use OCA\News\Db\Mysql\ItemMapper as MysqlMapper;
-class MapperFactoryTest extends PHPUnit_Framework_TestCase {
-
- private $db;
- private $settings;
-
- public function setUp() {
- $this->db = $this->getMockBuilder(IDBConnection::class)
- ->disableOriginalConstructor()
- ->getMock();
- }
-
- public function testGetItemMapperSqlite() {
- $factory = new MapperFactory($this->db, 'sqlite', new Time());
- $this->assertTrue($factory->build() instanceof ItemMapper);
- }
-
- public function testGetItemMapperPostgres() {
- $factory = new MapperFactory($this->db, 'pgsql', new Time());
- $this->assertTrue($factory->build() instanceof ItemMapper);
- }
-
- public function testGetItemMapperMysql() {
- $factory = new MapperFactory($this->db, 'mysql', new Time());
- $this->assertTrue($factory->build() instanceof MysqlMapper);
- }
+class MapperFactoryTest extends PHPUnit_Framework_TestCase
+{
+
+ private $db;
+ private $settings;
+
+ public function setUp()
+ {
+ $this->db = $this->getMockBuilder(IDBConnection::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ }
+
+ public function testGetItemMapperSqlite()
+ {
+ $factory = new MapperFactory($this->db, 'sqlite', new Time());
+ $this->assertTrue($factory->build() instanceof ItemMapper);
+ }
+
+ public function testGetItemMapperPostgres()
+ {
+ $factory = new MapperFactory($this->db, 'pgsql', new Time());
+ $this->assertTrue($factory->build() instanceof ItemMapper);
+ }
+
+ public function testGetItemMapperMysql()
+ {
+ $factory = new MapperFactory($this->db, 'mysql', new Time());
+ $this->assertTrue($factory->build() instanceof MysqlMapper);
+ }
}
diff --git a/tests/Unit/Db/MapperTestUtility.php b/tests/Unit/Db/MapperTestUtility.php
index 2448d8ddc..caef6527c 100644
--- a/tests/Unit/Db/MapperTestUtility.php
+++ b/tests/Unit/Db/MapperTestUtility.php
@@ -3,7 +3,7 @@
/**
* ownCloud - App Framework
*
- * @author Bernhard Posselt
+ * @author Bernhard Posselt
* @copyright 2012 Bernhard Posselt dev@bernhard-posselt.com
*
* This library is free software; you can redistribute it and/or
@@ -18,7 +18,6 @@
*
* 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/>.
- *
*/
@@ -27,7 +26,8 @@ namespace OCA\News\Tests\Unit\Db;
/**
* Simple utility class for testing mappers
*/
-abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
+abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase
+{
protected $db;
private $query;
private $queryAt;
@@ -40,11 +40,13 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
* Run this function before the actual test to either set or initialize the
* db. After this the db can be accessed by using $this->db
*/
- protected function setUp(){
+ protected function setUp()
+ {
parent::setUp();
$this->db = $this->getMockBuilder(
- '\OCP\IDBConnection')
+ '\OCP\IDBConnection'
+ )
->disableOriginalConstructor()
->getMock();
@@ -57,40 +59,47 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
/**
* Checks if an array is associative
- * @param array $array
+ *
+ * @param array $array
* @return bool true if associative
*/
- private function isAssocArray(array $array) {
+ private function isAssocArray(array $array)
+ {
return array_values($array) !== $array;
}
/**
* Returns the correct PDO constant based on the value type
- * @param $value
+ *
+ * @param $value
* @return PDO constant
*/
- private function getPDOType($value) {
+ private function getPDOType($value)
+ {
switch (gettype($value)) {
- case 'integer':
- return \PDO::PARAM_INT;
- case 'boolean':
- return \PDO::PARAM_BOOL;
- default:
- return \PDO::PARAM_STR;
+ case 'integer':
+ return \PDO::PARAM_INT;
+ case 'boolean':
+ return \PDO::PARAM_BOOL;
+ default:
+ return \PDO::PARAM_STR;
}
}
/**
* Create mocks and set expected results for database queries
- * @param string $sql the sql query that you expect to receive
- * @param array $arguments the expected arguments for the prepare query
- * method
- * @param array $returnRows the rows that should be returned for the result
- * of the database query. If not provided, it wont be assumed that fetch
- * will be called on the result
+ *
+ * @param string $sql the sql query that you expect to receive
+ * @param array $arguments the expected arguments for the prepare query
+ * method
+ * @param array $returnRows the rows that should be returned for the result
+ * of the database query. If not provided, it wont
+ * be assumed that fetch will be called on the
+ * result
*/
protected function setMapperResult($sql, $arguments=array(), $returnRows=array(),
- $limit=null, $offset=null, $expectClose=false){
+ $limit=null, $offset=null, $expectClose=false
+ ) {
if($limit === null && $offset === null) {
$this->db->expects($this->at($this->prepareAt))
->method('prepare')
@@ -104,16 +113,20 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
} elseif($limit === null && $offset !== null) {
$this->db->expects($this->at($this->prepareAt))
->method('prepare')
- ->with($this->equalTo($sql),
+ ->with(
+ $this->equalTo($sql),
$this->equalTo(null),
- $this->equalTo($offset))
+ $this->equalTo($offset)
+ )
->will(($this->returnValue($this->query)));
} else {
$this->db->expects($this->at($this->prepareAt))
->method('prepare')
- ->with($this->equalTo($sql),
+ ->with(
+ $this->equalTo($sql),
$this->equalTo($limit),
- $this->equalTo($offset))
+ $this->equalTo($offset)
+ )
->will(($this->returnValue($this->query)));
}
@@ -124,29 +137,33 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
$this->query->expects($this->any())
->method('fetch')
- ->will($this->returnCallback(
- function() use ($iterators, $fetchAt){
- $iterator = $iterators[$fetchAt];
- $result = $iterator->next();
+ ->will(
+ $this->returnCallback(
+ function () use ($iterators, $fetchAt) {
+ $iterator = $iterators[$fetchAt];
+ $result = $iterator->next();
- if($result === false) {
- $fetchAt++;
- }
+ if($result === false) {
+ $fetchAt++;
+ }
- $this->queryAt++;
+ $this->queryAt++;
- return $result;
- }
- ));
+ return $result;
+ }
+ )
+ );
if ($this->isAssocArray($arguments)) {
foreach($arguments as $key => $argument) {
$pdoConstant = $this->getPDOType($argument);
$this->query->expects($this->at($this->queryAt))
->method('bindValue')
- ->with($this->equalTo($key),
+ ->with(
+ $this->equalTo($key),
$this->equalTo($argument),
- $this->equalTo($pdoConstant));
+ $this->equalTo($pdoConstant)
+ );
$this->queryAt++;
}
} else {
@@ -155,9 +172,11 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
$pdoConstant = $this->getPDOType($argument);
$this->query->expects($this->at($this->queryAt))
->method('bindValue')
- ->with($this->equalTo($index),
+ ->with(
+ $this->equalTo($index),
$this->equalTo($argument),
- $this->equalTo($pdoConstant));
+ $this->equalTo($pdoConstant)
+ );
$index++;
$this->queryAt++;
}
@@ -165,9 +184,13 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
$this->query->expects($this->at($this->queryAt))
->method('execute')
- ->will($this->returnCallback(function($sql, $p=null, $o=null, $s=null) {
+ ->will(
+ $this->returnCallback(
+ function ($sql, $p=null, $o=null, $s=null) {
- }));
+ }
+ )
+ );
$this->queryAt++;
@@ -188,17 +211,20 @@ abstract class MapperTestUtility extends \PHPUnit_Framework_TestCase {
}
-class ArgumentIterator {
+class ArgumentIterator
+{
private $arguments;
- public function __construct($arguments){
+ public function __construct($arguments)
+ {
$this->arguments = $arguments;
}
- public function next(){
+ public function next()
+ {
$result = array_shift($this->arguments);
- if($result === null){
+ if($result === null) {
return false;
} else {
return $result;