Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-11-27 17:27:18 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2019-11-27 17:27:18 +0300
commit3a7cf40aaa678bea1df143d2982d603b7a334eec (patch)
tree63c1e3ad7f7f401d14411a4d44c523632906afc9 /tests/lib/IntegrityCheck
parent0568b012672d650c6b5a49e72c4028dde5463c60 (diff)
Mode to modern phpunit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib/IntegrityCheck')
-rw-r--r--tests/lib/IntegrityCheck/CheckerTest.php34
-rw-r--r--tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php10
-rw-r--r--tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php2
-rw-r--r--tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php18
-rw-r--r--tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php2
5 files changed, 33 insertions, 33 deletions
diff --git a/tests/lib/IntegrityCheck/CheckerTest.php b/tests/lib/IntegrityCheck/CheckerTest.php
index e7553aeac1f..586a42ff547 100644
--- a/tests/lib/IntegrityCheck/CheckerTest.php
+++ b/tests/lib/IntegrityCheck/CheckerTest.php
@@ -51,7 +51,7 @@ class CheckerTest extends TestCase {
/** @var \OC\Files\Type\Detection|\PHPUnit_Framework_MockObject_MockObject */
private $mimeTypeDetector;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->environmentHelper = $this->createMock(EnvironmentHelper::class);
$this->fileAccessHelper = $this->createMock(FileAccessHelper::class);
@@ -82,11 +82,11 @@ class CheckerTest extends TestCase {
);
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage Exception message
- */
+
public function testWriteAppSignatureOfNotExistingApp() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Exception message');
+
$this->fileAccessHelper
->expects($this->at(0))
->method('assertDirectoryExists')
@@ -107,11 +107,11 @@ class CheckerTest extends TestCase {
$this->checker->writeAppSignature('NotExistingApp', $x509, $rsa);
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessageRegExp /[a-zA-Z\/_-]+ is not writable/
- */
+
public function testWriteAppSignatureWrongPermissions() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessageRegExp('/[a-zA-Z\\/_-]+ is not writable/');
+
$this->fileAccessHelper
->expects($this->once())
->method('file_put_contents')
@@ -480,11 +480,11 @@ class CheckerTest extends TestCase {
$this->assertSame([], $this->checker->verifyAppSignature('SomeApp'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage Exception message
- */
+
public function testWriteCoreSignatureWithException() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Exception message');
+
$this->fileAccessHelper
->expects($this->at(0))
->method('assertDirectoryExists')
@@ -504,11 +504,11 @@ class CheckerTest extends TestCase {
$this->checker->writeCoreSignature($x509, $rsa, __DIR__);
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessageRegExp /[a-zA-Z\/_-]+ is not writable/
- */
+
public function testWriteCoreSignatureWrongPermissions() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessageRegExp('/[a-zA-Z\\/_-]+ is not writable/');
+
$this->fileAccessHelper
->expects($this->at(0))
->method('assertDirectoryExists')
diff --git a/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php b/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php
index 333b29f826c..cf5899b663b 100644
--- a/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php
+++ b/tests/lib/IntegrityCheck/Helpers/AppLocatorTest.php
@@ -28,7 +28,7 @@ class AppLocatorTest extends TestCase {
/** @var AppLocator */
private $locator;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->locator = new AppLocator();
}
@@ -37,11 +37,11 @@ class AppLocatorTest extends TestCase {
$this->assertSame(\OC_App::getAppPath('files'), $this->locator->getAppPath('files'));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage App not found
- */
+
public function testGetAppPathNotExistentApp() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('App not found');
+
$this->locator->getAppPath('aTotallyNotExistingApp');
}
diff --git a/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php b/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php
index 079baaafe9f..767cdf3aaab 100644
--- a/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php
+++ b/tests/lib/IntegrityCheck/Helpers/EnvironmentHelperTest.php
@@ -28,7 +28,7 @@ class EnvironmentHelperTest extends TestCase {
/** @var EnvironmentHelper */
private $environmentHelper;
- public function setUp(): void {
+ protected function setUp(): void {
$this->environmentHelper = new EnvironmentHelper();
parent::setUp();
}
diff --git a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
index 87c064a8458..c4d724a3654 100644
--- a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
+++ b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
@@ -28,7 +28,7 @@ class FileAccessHelperTest extends TestCase {
/** @var FileAccessHelper */
private $fileAccessHelper;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->fileAccessHelper = new FileAccessHelper();
}
@@ -42,11 +42,11 @@ class FileAccessHelperTest extends TestCase {
$this->assertSame($data, $this->fileAccessHelper->file_get_contents($filePath));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage Failed to write into /anabsolutelynotexistingfolder/on/the/system.txt
- */
+
public function testFile_put_contentsWithException() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Failed to write into /anabsolutelynotexistingfolder/on/the/system.txt');
+
$this->fileAccessHelper->file_put_contents('/anabsolutelynotexistingfolder/on/the/system.txt', 'MyFiles');
}
@@ -55,11 +55,11 @@ class FileAccessHelperTest extends TestCase {
$this->assertTrue($this->fileAccessHelper->is_writable(\OC::$server->getTempManager()->getTemporaryFile('MyFile')));
}
- /**
- * @expectedException \Exception
- * @expectedExceptionMessage Directory /anabsolutelynotexistingfolder/on/the/system does not exist.
- */
+
public function testAssertDirectoryExistsWithException() {
+ $this->expectException(\Exception::class);
+ $this->expectExceptionMessage('Directory /anabsolutelynotexistingfolder/on/the/system does not exist.');
+
$this->fileAccessHelper->assertDirectoryExists('/anabsolutelynotexistingfolder/on/the/system');
}
diff --git a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php
index 081d2b5cb01..370b50a56e2 100644
--- a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php
+++ b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php
@@ -28,7 +28,7 @@ class ExcludeFileByNameFilterIteratorTest extends TestCase {
/** @var ExcludeFileByNameFilterIterator|\PHPUnit\Framework\MockObject\MockObject */
protected $filter;
- public function setUp(): void {
+ protected function setUp(): void {
parent::setUp();
$this->filter = $this->getMockBuilder(ExcludeFileByNameFilterIterator::class)
->disableOriginalConstructor()