From a6406e53f6f614b6a9e44e37d44c67f45a08b17d Mon Sep 17 00:00:00 2001 From: brantje Date: Tue, 20 Dec 2016 00:36:01 +0100 Subject: [PATCH] Add test --- controller/translationcontroller.php | 2 +- .../controller/TranslationControllerTest.php | 57 +++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 tests/unit/controller/TranslationControllerTest.php diff --git a/controller/translationcontroller.php b/controller/translationcontroller.php index 32922e29..71f33013 100644 --- a/controller/translationcontroller.php +++ b/controller/translationcontroller.php @@ -14,7 +14,7 @@ namespace OCA\Passman\Controller; use OCP\IRequest; use OCP\AppFramework\Http\JSONResponse; use OCP\AppFramework\ApiController; -use \OCP\IL10N; +use OCP\IL10N; class TranslationController extends ApiController { private $trans; diff --git a/tests/unit/controller/TranslationControllerTest.php b/tests/unit/controller/TranslationControllerTest.php new file mode 100644 index 00000000..b7301bc6 --- /dev/null +++ b/tests/unit/controller/TranslationControllerTest.php @@ -0,0 +1,57 @@ +. + * + */ + +namespace OCA\Passman\Controller; + +use OCP\AppFramework\Http\JSONResponse; +use PHPUnit_Framework_TestCase; + + +/** + * Class PageControllerTest + * + * @package OCA\Passman\Controller + * @coversDefaultClass \OCA\Passman\Controller\PageController + */ +class TranslationControllerTest extends PHPUnit_Framework_TestCase { + + private $controller; + private $userId = 'john'; + + public function setUp() { + $request = $this->getMockBuilder('OCP\IRequest')->getMock(); + $IL10N = $this->getMockBuilder('OCP\IL10N')->getMock(); + + $this->controller = new TranslationController( + 'passman', $request, $IL10N + ); + } + + /** + * @covers ::getLanguageStrings + */ + public function getLanguageStrings() { + $result = $this->controller->getLanguageStrings(); + $this->assertTrue($result instanceof JSONResponse); + } +} \ No newline at end of file