From 004fcbbcc7609ca83807f2e38967ef54f469bf72 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 23 Jul 2016 21:24:54 +0200 Subject: Move to new directory structure --- tests/Unit/Upgrade/UpgradeTest.php | 72 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 tests/Unit/Upgrade/UpgradeTest.php (limited to 'tests/Unit/Upgrade') diff --git a/tests/Unit/Upgrade/UpgradeTest.php b/tests/Unit/Upgrade/UpgradeTest.php new file mode 100644 index 000000000..a3d473b63 --- /dev/null +++ b/tests/Unit/Upgrade/UpgradeTest.php @@ -0,0 +1,72 @@ +config = $this->getMockBuilder( + '\OCP\IConfig') + ->disableOriginalConstructor() + ->getMock(); + + $this->db = $this->getMockBuilder( + '\OCP\IDBConnection') + ->disableOriginalConstructor() + ->getMock(); + + $this->service = $this->getMockBuilder( + '\OCA\News\Service\ItemService') + ->disableOriginalConstructor() + ->getMock(); + + $this->upgrade = new Upgrade($this->config, $this->service, + $this->db, 'news'); + } + + public function testUpgrade() { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with($this->equalTo('news'), $this->equalTo('installed_version')) + ->will($this->returnValue('8.9.0')); + + $this->service->expects($this->once()) + ->method('generateSearchIndices'); + + $this->upgrade->upgrade(); + } + + public function testNoUpgrade() { + $this->config->expects($this->once()) + ->method('getAppValue') + ->with($this->equalTo('news'), $this->equalTo('installed_version')) + ->will($this->returnValue('8.9.1')); + + $this->service->expects($this->never()) + ->method('generateSearchIndices'); + + $this->upgrade->upgrade(); + } + +} -- cgit v1.2.3