summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-09-07 19:42:23 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-09-07 20:42:37 +0200
commit9ea2153e9be84a7a0bafc469289b66669bba9852 (patch)
tree04441074a862d028a1593d02477745269376d4e9 /tests
parent4066f04c4b74c54450559042256e910a19e4a68b (diff)
downloadnextcloud-server-9ea2153e9be84a7a0bafc469289b66669bba9852.tar.gz
nextcloud-server-9ea2153e9be84a7a0bafc469289b66669bba9852.zip
Fix getMock Command/Intergrity
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/Command/Integrity/SignAppTest.php35
-rw-r--r--tests/lib/Command/Integrity/SignCoreTest.php28
2 files changed, 31 insertions, 32 deletions
diff --git a/tests/lib/Command/Integrity/SignAppTest.php b/tests/lib/Command/Integrity/SignAppTest.php
index 44a644c45df..71d9946ee88 100644
--- a/tests/lib/Command/Integrity/SignAppTest.php
+++ b/tests/lib/Command/Integrity/SignAppTest.php
@@ -24,6 +24,8 @@ use OC\Core\Command\Integrity\SignApp;
use OC\IntegrityCheck\Checker;
use OC\IntegrityCheck\Helpers\FileAccessHelper;
use OCP\IURLGenerator;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class SignAppTest extends TestCase {
@@ -38,12 +40,9 @@ class SignAppTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker')
- ->disableOriginalConstructor()->getMock();
- $this->fileAccessHelper = $this->getMockBuilder('\OC\IntegrityCheck\Helpers\FileAccessHelper')
- ->disableOriginalConstructor()->getMock();
- $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')
- ->disableOriginalConstructor()->getMock();
+ $this->checker = $this->createMock(Checker::class);
+ $this->fileAccessHelper = $this->createMock(FileAccessHelper::class);
+ $this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->signApp = new SignApp(
$this->checker,
$this->fileAccessHelper,
@@ -52,8 +51,8 @@ class SignAppTest extends TestCase {
}
public function testExecuteWithMissingPath() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))
@@ -80,8 +79,8 @@ class SignAppTest extends TestCase {
}
public function testExecuteWithMissingPrivateKey() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))
@@ -108,8 +107,8 @@ class SignAppTest extends TestCase {
}
public function testExecuteWithMissingCertificate() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))
@@ -136,8 +135,8 @@ class SignAppTest extends TestCase {
}
public function testExecuteWithNotExistingPrivateKey() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))
@@ -170,8 +169,8 @@ class SignAppTest extends TestCase {
}
public function testExecuteWithNotExistingCertificate() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))
@@ -209,8 +208,8 @@ class SignAppTest extends TestCase {
}
public function testExecute() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))
diff --git a/tests/lib/Command/Integrity/SignCoreTest.php b/tests/lib/Command/Integrity/SignCoreTest.php
index ff1f6b23a95..f3c242ae9fb 100644
--- a/tests/lib/Command/Integrity/SignCoreTest.php
+++ b/tests/lib/Command/Integrity/SignCoreTest.php
@@ -23,6 +23,8 @@ namespace Test\Command\Integrity;
use OC\Core\Command\Integrity\SignCore;
use OC\IntegrityCheck\Checker;
use OC\IntegrityCheck\Helpers\FileAccessHelper;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
use Test\TestCase;
class SignCoreTest extends TestCase {
@@ -35,10 +37,8 @@ class SignCoreTest extends TestCase {
public function setUp() {
parent::setUp();
- $this->checker = $this->getMockBuilder('\OC\IntegrityCheck\Checker')
- ->disableOriginalConstructor()->getMock();
- $this->fileAccessHelper = $this->getMockBuilder('\OC\IntegrityCheck\Helpers\FileAccessHelper')
- ->disableOriginalConstructor()->getMock();
+ $this->checker = $this->createMock(Checker::class);
+ $this->fileAccessHelper = $this->createMock(FileAccessHelper::class);
$this->signCore = new SignCore(
$this->checker,
$this->fileAccessHelper
@@ -46,8 +46,8 @@ class SignCoreTest extends TestCase {
}
public function testExecuteWithMissingPrivateKey() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))
@@ -69,8 +69,8 @@ class SignCoreTest extends TestCase {
}
public function testExecuteWithMissingCertificate() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))
@@ -92,8 +92,8 @@ class SignCoreTest extends TestCase {
}
public function testExecuteWithNotExistingPrivateKey() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))
@@ -126,8 +126,8 @@ class SignCoreTest extends TestCase {
}
public function testExecuteWithNotExistingCertificate() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))
@@ -165,8 +165,8 @@ class SignCoreTest extends TestCase {
}
public function testExecute() {
- $inputInterface = $this->getMock('\Symfony\Component\Console\Input\InputInterface');
- $outputInterface = $this->getMock('\Symfony\Component\Console\Output\OutputInterface');
+ $inputInterface = $this->createMock(InputInterface::class);
+ $outputInterface = $this->createMock(OutputInterface::class);
$inputInterface
->expects($this->at(0))