Add jsonSerialize method to RelationalEntity

Signed-off-by: Julius Haertl <jus@bitgrid.net>
This commit is contained in:
Julius Haertl
2017-03-05 13:43:54 +01:00
committed by Julius Härtl
parent 3324556542
commit 34c1a681b1
8 changed files with 45 additions and 70 deletions

View File

@@ -21,7 +21,8 @@ class BoardTest extends \PHPUnit_Framework_TestCase {
'owner' => "admin",
'color' => "000000",
'labels' => null,
'acl' => null
'acl' => null,
'archived' => false
], $board->jsonSerialize());
}
@@ -34,7 +35,8 @@ class BoardTest extends \PHPUnit_Framework_TestCase {
'owner' => "admin",
'color' => "000000",
'labels' => array("foo", "bar"),
'acl' => null
'acl' => null,
'archived' => false
], $board->jsonSerialize());
}
public function testSetAcl() {
@@ -55,6 +57,7 @@ class BoardTest extends \PHPUnit_Framework_TestCase {
'color' => "000000",
'labels' => null,
'acl' => null,
'archived' => false,
'shared' => 1,
], $board->jsonSerialize());
}

View File

@@ -23,7 +23,7 @@
namespace OCA\Deck\Db;
class EntityTest extends \PHPUnit_Framework_TestCase {
class RelationalEntityTest extends \Test\TestCase {
public function testRelation() {
$entity = new RelationalEntity();
@@ -40,4 +40,13 @@ class EntityTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals(['foo'=>true], $entity->getUpdatedFields());
}
public function testJsonSerialize() {
$entity = new RelationalEntity();
$entity->setId(123);
$json = [
'id' => 123,
];
$this->assertEquals($json, $entity->jsonSerialize());
}
}