From fa0315a043250b62fb41fc661aa26c0f9de5eb80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Sun, 10 Feb 2019 17:12:48 +0100 Subject: Fix tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- tests/integration/AppTest.php | 36 ---------------------- .../ContactsMenu/Provider/DetailsProviderTest.php | 2 +- tests/unit/Controller/PageControllerTest.php | 9 +++--- 3 files changed, 6 insertions(+), 41 deletions(-) delete mode 100644 tests/integration/AppTest.php (limited to 'tests') diff --git a/tests/integration/AppTest.php b/tests/integration/AppTest.php deleted file mode 100644 index 6adedf1f..00000000 --- a/tests/integration/AppTest.php +++ /dev/null @@ -1,36 +0,0 @@ - - * @copyright Hendrik Leppelsack 2015 - */ - -use OCP\AppFramework\App; -use Test\TestCase; - - -/** - * This test shows how to make a small Integration Test. Query your class - * directly from the container, only pass in mocks if needed and run your tests - * against the database - */ -class AppTest extends TestCase { - - private $container; - - public function setUp() { - parent::setUp(); - $app = new App('contacts'); - $this->container = $app->getContainer(); - } - - public function testAppInstalled() { - $appManager = $this->container->query('OCP\App\IAppManager'); - $this->assertTrue($appManager->isInstalled('contacts')); - } - -} diff --git a/tests/unit/ContactsMenu/Provider/DetailsProviderTest.php b/tests/unit/ContactsMenu/Provider/DetailsProviderTest.php index e4dd747b..a6d33cb0 100644 --- a/tests/unit/ContactsMenu/Provider/DetailsProviderTest.php +++ b/tests/unit/ContactsMenu/Provider/DetailsProviderTest.php @@ -56,7 +56,7 @@ class DetailsProviderTest extends Base { /** @var DetailsProvider */ private $provider; - protected function setUp() { + protected function setUp(): void { parent::setUp(); $this->urlGenerator = $this->createMock(IURLGenerator::class); diff --git a/tests/unit/Controller/PageControllerTest.php b/tests/unit/Controller/PageControllerTest.php index 99d74bf1..0eb027a3 100644 --- a/tests/unit/Controller/PageControllerTest.php +++ b/tests/unit/Controller/PageControllerTest.php @@ -18,13 +18,15 @@ use PHPUnit\Framework\TestCase as Base; class PageControllerTest extends Base { private $controller; - private $userId = 'john'; - public function setUp() { + public function setUp(): void { + $config = $this->getMockBuilder('OCP\IConfig')->getMock(); $request = $this->getMockBuilder('OCP\IRequest')->getMock(); $this->controller = new PageController( - 'contacts', $request, $this->userId + 'contacts', + $request, + $config ); } @@ -32,7 +34,6 @@ class PageControllerTest extends Base { public function testIndex() { $result = $this->controller->index(); - $this->assertEquals(['user' => 'john'], $result->getParams()); $this->assertEquals('main', $result->getTemplateName()); $this->assertEquals('user', $result->getRenderAs()); $this->assertTrue($result instanceof TemplateResponse); -- cgit v1.2.3