diff options
Diffstat (limited to 'tests/Unit/Service/StatusServiceTest.php')
-rw-r--r-- | tests/Unit/Service/StatusServiceTest.php | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/tests/Unit/Service/StatusServiceTest.php b/tests/Unit/Service/StatusServiceTest.php index ca1029504..aa2cbde0e 100644 --- a/tests/Unit/Service/StatusServiceTest.php +++ b/tests/Unit/Service/StatusServiceTest.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\Service; @@ -17,36 +17,45 @@ use \OCA\News\Db\FeedType; use OCA\News\Service\StatusService; -class StatusServiceTest extends \PHPUnit_Framework_TestCase { +class StatusServiceTest extends \PHPUnit_Framework_TestCase +{ private $settings; private $config; private $service; private $appName; - public function setUp(){ + public function setUp() + { $this->appName = 'news'; $this->settings = $this->getMockBuilder( - '\OCP\IConfig') + '\OCP\IConfig' + ) ->disableOriginalConstructor() ->getMock(); $this->config = $this->getMockBuilder( - '\OCA\News\Config\Config') + '\OCA\News\Config\Config' + ) ->disableOriginalConstructor() ->getMock(); - $this->db = $this->getMockBuilder("\OCP\IDBConnection") - ->disableOriginalConstructor() - ->getMock(); - $this->service = new StatusService($this->settings, $this->db, - $this->config, $this->appName); + $this->db = $this->getMockBuilder("\OCP\IDBConnection") + ->disableOriginalConstructor() + ->getMock(); + $this->service = new StatusService( + $this->settings, $this->db, + $this->config, $this->appName + ); } private function beforeStatus($cronMode='cron', $cronEnabled=true, - $version='1.0') { + $version='1.0' + ) { $this->settings->expects($this->at(0)) ->method('getAppValue') - ->with($this->equalTo($this->appName), - $this->equalTo('installed_version')) + ->with( + $this->equalTo($this->appName), + $this->equalTo('installed_version') + ) ->will($this->returnValue($version)); $this->settings->expects($this->at(1)) @@ -64,7 +73,8 @@ class StatusServiceTest extends \PHPUnit_Framework_TestCase { } - public function testGetStatus(){ + public function testGetStatus() + { $this->beforeStatus(); $response = $this->service->getStatus(); @@ -73,7 +83,8 @@ class StatusServiceTest extends \PHPUnit_Framework_TestCase { } - public function testGetStatusNoCorrectCronAjax(){ + public function testGetStatusNoCorrectCronAjax() + { $this->beforeStatus('ajax'); $response = $this->service->getStatus(); @@ -82,7 +93,8 @@ class StatusServiceTest extends \PHPUnit_Framework_TestCase { - public function testGetStatusNoCorrectCronTurnedOff(){ + public function testGetStatusNoCorrectCronTurnedOff() + { $this->beforeStatus('ajax', false); $response = $this->service->getStatus(); |