diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-21 20:38:09 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-21 20:38:20 +0100 |
commit | c8bdd9c3fb0ab872b868c151f052748235601653 (patch) | |
tree | af4ffc33ad013f817af14aed25e54606429ad612 /tests/bl/FeedBlTest.php | |
parent | d692600a31bf4aa9be8b71d8fcb16e90e9393aea (diff) |
finished feedcontroller
Diffstat (limited to 'tests/bl/FeedBlTest.php')
-rw-r--r-- | tests/bl/FeedBlTest.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/bl/FeedBlTest.php b/tests/bl/FeedBlTest.php index 08f98beab..444018349 100644 --- a/tests/bl/FeedBlTest.php +++ b/tests/bl/FeedBlTest.php @@ -36,6 +36,8 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility { protected $api; protected $feedMapper; protected $feedBl; + protected $user; + protected $response; protected function setUp(){ $this->api = $this->getAPIMock(); @@ -43,11 +45,62 @@ class FeedBlTest extends \OCA\AppFramework\Utility\TestUtility { ->disableOriginalConstructor() ->getMock(); $this->feedBl = new FeedBl($this->feedMapper); + $this->user = 'jack'; + $response = 'hi'; } public function testFindAll(){ + $this->feedMapper->expects($this->once()) + ->method('findAll') + ->will($this->returnValue($this->response)); + $result = $this->feedBl->findAll(); + $this->assertEquals($this->response, $result); } + + public function testFindAllFromUser(){ + $this->feedMapper->expects($this->once()) + ->method('findAllFromUser') + ->with($this->equalTo($this->user)) + ->will($this->returnValue($this->response)); + + $result = $this->feedBl->findAllFromUser($this->user); + $this->assertEquals($this->response, $result); + } + + + public function testCreate(){ + // TODO + } + + + public function testUpdate(){ + // TODO + } + + + public function testMove(){ + $feedId = 3; + $folderId = 4; + $feed = new Feed(); + $feed->setFolderId(16); + $feed->setId($feedId); + + $this->feedMapper->expects($this->once()) + ->method('find') + ->with($this->equalTo($feedId), $this->equalTo($this->user)) + ->will($this->returnValue($feed)); + + $this->feedMapper->expects($this->once()) + ->method('update') + ->with($this->equalTo($feed)); + + $this->feedBl->move($feedId, $folderId, $this->user); + + $this->assertEquals($folderId, $feed->getFolderId()); + } + + }
\ No newline at end of file |