summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--db/entity.php36
-rw-r--r--js/Makefile2
-rw-r--r--tests/db/EntityTest.php56
3 files changed, 93 insertions, 1 deletions
diff --git a/db/entity.php b/db/entity.php
new file mode 100644
index 000000000..9adab3b7f
--- /dev/null
+++ b/db/entity.php
@@ -0,0 +1,36 @@
+<?php
+
+/**
+* ownCloud - News
+*
+* @author Alessandro Copyright
+* @author Bernhard Posselt
+* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2012 Bernhard Posselt nukeawhale@gmail.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;
+
+abstract class Entity {
+
+ public function fromRow($row){
+ foreach($row as $key => $value){
+ $this->$key = $value;
+ }
+ }
+
+} \ No newline at end of file
diff --git a/js/Makefile b/js/Makefile
index 2a0b8577d..7823bfa26 100644
--- a/js/Makefile
+++ b/js/Makefile
@@ -38,7 +38,7 @@ testacular: deps
export CHROME_BIN=$(chrome_bin) && export FIREFOX_BIN=$(firefox_bin) && \
$(grunt) --config $(CURDIR)/Gruntfile.coffee testacular
-phpunit:
+phpunit: deps
$(grunt) --config $(CURDIR)/Gruntfile.coffee testphp
compile: deps
diff --git a/tests/db/EntityTest.php b/tests/db/EntityTest.php
new file mode 100644
index 000000000..8d5705c74
--- /dev/null
+++ b/tests/db/EntityTest.php
@@ -0,0 +1,56 @@
+<?php
+
+/**
+* ownCloud - News
+*
+* @author Alessandro Copyright
+* @author Bernhard Posselt
+* @copyright 2012 Alessandro Cosentino cosenal@gmail.com
+* @copyright 2012 Bernhard Posselt nukeawhale@gmail.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;
+
+require_once(__DIR__ . "/../classloader.php");
+
+
+class TestEntity extends Entity {
+ public $name;
+ public $email;
+};
+
+class EntityTest extends \PHPUnit_Framework_TestCase {
+
+ protected function setUp(){
+
+ }
+
+
+ public function testFromRow(){
+ $row = array(
+ 'name' => 'john',
+ 'email' => 'john@something.com'
+ );
+ $entity = new TestEntity();
+
+ $entity->fromRow($row);
+
+ $this->assertEquals($row['name'], $entity->name);
+ $this->assertEquals($row['email'], $entity->email);
+ }
+
+} \ No newline at end of file