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:
authorDaniel Kesselberg <mail@danielkesselberg.de>2019-02-14 02:18:49 +0300
committerDaniel Kesselberg <mail@danielkesselberg.de>2019-02-14 13:48:15 +0300
commit7404c10666e4ec5283b4a5b2d4c2ffc412b7a64b (patch)
tree174f83e3c69607135ced0869ccb1cc7aa9c3bf7f /tests/lib/IntegrityCheck
parenta5bc27c2a6982b4a734dc8ba07bbb2aa2aafb6dc (diff)
Apply code style fixes from owncloud, revert regex
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'tests/lib/IntegrityCheck')
-rw-r--r--tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php52
1 files changed, 27 insertions, 25 deletions
diff --git a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php
index 109a37823df..335f6e3fd3d 100644
--- a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php
+++ b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php
@@ -25,25 +25,25 @@ use \OC\IntegrityCheck\Iterator\ExcludeFileByNameFilterIterator;
use Test\TestCase;
class ExcludeFileByNameFilterIteratorTest extends TestCase {
- /** @var ExcludeFileByNameFilterIterator */
+ /** @var ExcludeFileByNameFilterIterator|\PHPUnit\Framework\MockObject\MockObject */
protected $filter;
public function setUp() {
parent::setUp();
$this->filter = $this->getMockBuilder(ExcludeFileByNameFilterIterator::class)
->disableOriginalConstructor()
- ->getMock()
- ;
+ ->setMethods(['current'])
+ ->getMock();
}
- public function fileNameProvider(){
+ public function fileNameProvider(): array {
return [
['a file', true],
['Thumbs.db', false],
['another file', true],
['.directory', false],
- ['.webapp-netxcloud-12.0.5', false],
+ ['.webapp-nextcloud-12.0.5', false],
['wx.webapp-nextcloud-obee', true],
];
}
@@ -53,17 +53,18 @@ class ExcludeFileByNameFilterIteratorTest extends TestCase {
* @param string $fileName
* @param bool $expectedResult
*/
- public function testAcceptForFiles($fileName, $expectedResult){
- $iteratorMock = $this->createMock(\DirectoryIterator::class);
- $iteratorMock->method('getFilename')
- ->will($this->returnValue($fileName))
- ;
+ public function testAcceptForFiles($fileName, $expectedResult): void {
+ $iteratorMock = $this->getMockBuilder(\RecursiveDirectoryIterator::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getFilename', 'isDir'])
+ ->getMock();
- $this->filter->method('isDir')
- ->will($this->returnValue(false));
+ $iteratorMock->method('getFilename')
+ ->willReturn($fileName);
+ $iteratorMock->method('isDir')
+ ->willReturn(false);
$this->filter->method('current')
- ->will($this->returnValue($iteratorMock))
- ;
+ ->willReturn($iteratorMock);
$actualResult = $this->filter->accept();
$this->assertEquals($expectedResult, $actualResult);
@@ -72,21 +73,22 @@ class ExcludeFileByNameFilterIteratorTest extends TestCase {
/**
* @dataProvider fileNameProvider
* @param string $fileName
- * @param bool $fakeExpectedResult
+ * @param bool $expectedResult
*/
- public function testAcceptForDirs($fileName, $fakeExpectedResult){
- $iteratorMock = $this->createMock(\DirectoryIterator::class);
- $iteratorMock->method('getFilename')
- ->will($this->returnValue($fileName))
- ;
+ public function testAcceptForDirs($fileName, $expectedResult): void {
+ $iteratorMock = $this->getMockBuilder(\RecursiveDirectoryIterator::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getFilename', 'isDir'])
+ ->getMock();
- $this->filter->method('isDir')
- ->will($this->returnValue(true));
+ $iteratorMock->method('getFilename')
+ ->willReturn($fileName);
+ $iteratorMock->method('isDir')
+ ->willReturn(true);
$this->filter->method('current')
- ->will($this->returnValue($iteratorMock))
- ;
+ ->willReturn($iteratorMock);
$actualResult = $this->filter->accept();
- $this->assertFalse($actualResult);
+ $this->assertTrue($actualResult);
}
}