diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-10-17 15:27:43 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-10-17 15:27:43 -0400 |
commit | 9283fb88d80cb355ff98364a9a57b657fc511d98 (patch) | |
tree | 52c99cd8adf28e3eb2c30c3d625817b48a8cd4ec /tests/units/Model/UserMetadataTest.php | |
parent | 9153c6ff0ddb3170928d33599d9178e67ca466b6 (diff) |
Add metadata for users, tasks and projects
Diffstat (limited to 'tests/units/Model/UserMetadataTest.php')
-rw-r--r-- | tests/units/Model/UserMetadataTest.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/units/Model/UserMetadataTest.php b/tests/units/Model/UserMetadataTest.php new file mode 100644 index 00000000..cc1fff12 --- /dev/null +++ b/tests/units/Model/UserMetadataTest.php @@ -0,0 +1,33 @@ +<?php + +require_once __DIR__.'/../Base.php'; + +use Kanboard\Model\User; +use Kanboard\Model\UserMetadata; + +class UserMetadataTest extends Base +{ + public function testOperations() + { + $m = new UserMetadata($this->container); + $u = new User($this->container); + + $this->assertEquals(2, $u->create(array('username' => 'foobar'))); + + $this->assertTrue($m->save(1, array('key1' => 'value1'))); + $this->assertTrue($m->save(1, array('key1' => 'value2'))); + $this->assertTrue($m->save(2, array('key1' => 'value1'))); + $this->assertTrue($m->save(2, array('key2' => 'value2'))); + + $this->assertEquals('value2', $m->get(1, 'key1')); + $this->assertEquals('value1', $m->get(2, 'key1')); + $this->assertEquals('', $m->get(2, 'key3')); + $this->assertEquals('default', $m->get(2, 'key3', 'default')); + + $this->assertTrue($m->exists(2, 'key1')); + $this->assertFalse($m->exists(2, 'key3')); + + $this->assertEquals(array('key1' => 'value2'), $m->getAll(1)); + $this->assertEquals(array('key1' => 'value1', 'key2' => 'value2'), $m->getAll(2)); + } +} |