diff --git a/.gitignore b/.gitignore index f9ee40a07a4a..c9d628d92ea2 100644 --- a/.gitignore +++ b/.gitignore @@ -122,6 +122,7 @@ vendor-bin/**/composer.lock # Tests - auto-generated files /data-autotest +/tests/.phpunit.result.cache /tests/coverage* /tests/karma-coverage /tests/autoconfig* diff --git a/apps/files_external/tests/Command/ListCommandTest.php b/apps/files_external/tests/Command/ListCommandTest.php index 81a830b1c3bc..6d5ff691530d 100644 --- a/apps/files_external/tests/Command/ListCommandTest.php +++ b/apps/files_external/tests/Command/ListCommandTest.php @@ -162,7 +162,7 @@ public function testShortView($options, $expectedResult, $mountOptions) { for ($i = 0; $i < $countResults; $i++) { $this->assertEquals($expectedResult[$i]['mount_id'], $results[$i]['mount_id']); $this->assertEquals($expectedResult[$i]['mount_point'], $results[$i]['mount_point']); - $this->assertContains($results[$i]['auth'], 'UserSession', true); + $this->assertStringContainsString($results[$i]['auth'], 'UserSession', true); $this->assertEquals($expectedResult[$i]['type'], $results[$i]['type']); } } else { diff --git a/apps/files_external/tests/Panels/AdminTest.php b/apps/files_external/tests/Panels/AdminTest.php index 12c87a27d387..227b8eb4c180 100644 --- a/apps/files_external/tests/Panels/AdminTest.php +++ b/apps/files_external/tests/Panels/AdminTest.php @@ -72,6 +72,6 @@ public function testGetPanel() { $this->backendService->expects($this->once())->method('getBackends')->willReturn([]); $this->backendService->expects($this->once())->method('getAvailableBackends')->willReturn([]); $templateHtml = $this->panel->getPanel()->fetchPage(); - $this->assertContains('

External Storage

', $templateHtml); + $this->assertStringContainsString('

External Storage

', $templateHtml); } } diff --git a/apps/files_external/tests/Panels/PersonalTest.php b/apps/files_external/tests/Panels/PersonalTest.php index 2414de1f328c..2e5398dedc05 100644 --- a/apps/files_external/tests/Panels/PersonalTest.php +++ b/apps/files_external/tests/Panels/PersonalTest.php @@ -72,6 +72,6 @@ public function testGetPanel() { $this->backendService->expects($this->once())->method('getBackends')->willReturn([]); $this->backendService->expects($this->once())->method('getAvailableBackends')->willReturn([]); $templateHtml = $this->panel->getPanel()->fetchPage(); - $this->assertContains('

External Storage

', $templateHtml); + $this->assertStringContainsString('

External Storage

', $templateHtml); } } diff --git a/apps/files_trashbin/tests/ExpirationTest.php b/apps/files_trashbin/tests/ExpirationTest.php index bd89c0834de6..be707993ff46 100644 --- a/apps/files_trashbin/tests/ExpirationTest.php +++ b/apps/files_trashbin/tests/ExpirationTest.php @@ -138,9 +138,16 @@ public function testParseRetentionObligation($configValue, $expectedMinAge, $exp ); $expiration = new Expiration($mockedConfig, $mockedTimeFactory); - $this->assertAttributeEquals($expectedMinAge, 'minAge', $expiration); - $this->assertAttributeEquals($expectedMaxAge, 'maxAge', $expiration); - $this->assertAttributeEquals($expectedCanPurgeToSaveSpace, 'canPurgeToSaveSpace', $expiration); + $expirationInternals = (array) $expiration; + $expectedKey = "\0OCA\\Files_Trashbin\\Expiration\0minAge"; + $this->assertArrayHasKey($expectedKey, $expirationInternals); + $this->assertEquals($expectedMinAge, $expirationInternals[$expectedKey]); + $expectedKey = "\0OCA\\Files_Trashbin\\Expiration\0maxAge"; + $this->assertArrayHasKey($expectedKey, $expirationInternals); + $this->assertEquals($expectedMaxAge, $expirationInternals[$expectedKey]); + $expectedKey = "\0OCA\\Files_Trashbin\\Expiration\0canPurgeToSaveSpace"; + $this->assertArrayHasKey($expectedKey, $expirationInternals); + $this->assertEquals($expectedCanPurgeToSaveSpace, $expirationInternals[$expectedKey]); } public function timestampTestData() { diff --git a/apps/files_versions/tests/ExpirationTest.php b/apps/files_versions/tests/ExpirationTest.php index 0ed18f3857c6..aa43029e41cb 100644 --- a/apps/files_versions/tests/ExpirationTest.php +++ b/apps/files_versions/tests/ExpirationTest.php @@ -140,9 +140,16 @@ public function testParseRetentionObligation($configValue, $expectedMinAge, $exp ); $expiration = new Expiration($mockedConfig, $mockedTimeFactory); - $this->assertAttributeEquals($expectedMinAge, 'minAge', $expiration); - $this->assertAttributeEquals($expectedMaxAge, 'maxAge', $expiration); - $this->assertAttributeEquals($expectedCanPurgeToSaveSpace, 'canPurgeToSaveSpace', $expiration); + $expirationInternals = (array) $expiration; + $expectedKey = "\0OCA\\Files_Versions\\Expiration\0minAge"; + $this->assertArrayHasKey($expectedKey, $expirationInternals); + $this->assertEquals($expectedMinAge, $expirationInternals[$expectedKey]); + $expectedKey = "\0OCA\\Files_Versions\\Expiration\0maxAge"; + $this->assertArrayHasKey($expectedKey, $expirationInternals); + $this->assertEquals($expectedMaxAge, $expirationInternals[$expectedKey]); + $expectedKey = "\0OCA\\Files_Versions\\Expiration\0canPurgeToSaveSpace"; + $this->assertArrayHasKey($expectedKey, $expirationInternals); + $this->assertEquals($expectedCanPurgeToSaveSpace, $expirationInternals[$expectedKey]); } /** diff --git a/composer.json b/composer.json index 7c877fc5f7fb..bee87ebcd740 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "bamarni/composer-bin-plugin": "^1.4", "jakub-onderka/php-console-highlighter": "^0.4", "mikey179/vfsstream": "^1.6", - "phpunit/phpunit": "^7.5", + "phpunit/phpunit": "^8.5", "roave/security-advisories": "dev-master" }, "require": { diff --git a/composer.lock b/composer.lock index 2e6498e08b11..01ade358de9d 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5b401844dfa873864dfbd3f272c09c1d", + "content-hash": "f534d10686de81bc735d9542fc9fddda", "packages": [ { "name": "bantu/ini-get-wrapper", @@ -4088,40 +4088,40 @@ }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "7.0.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f1884187926fbb755a9aaf0b3836ad3165b478bf", + "reference": "f1884187926fbb755a9aaf0b3836ad3165b478bf", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", + "php": "^7.2", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", + "phpunit/php-token-stream": "^3.1.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", + "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -4147,7 +4147,7 @@ "testing", "xunit" ], - "time": "2018-10-31T16:06:48+00:00" + "time": "2019-11-20T13:55:58+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4340,53 +4340,52 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.20", + "version": "8.5.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + "reference": "8474e22d7d642f665084ba5ec780626cbd1efd23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8474e22d7d642f665084ba5ec780626cbd1efd23", + "reference": "8474e22d7d642f665084ba5ec780626cbd1efd23", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.2.0", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.9.1", + "phar-io/manifest": "^1.0.3", + "phar-io/version": "^2.0.1", + "php": "^7.2", + "phpspec/prophecy": "^1.8.1", + "phpunit/php-code-coverage": "^7.0.7", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.2", + "sebastian/exporter": "^3.1.1", + "sebastian/global-state": "^3.0.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", "sebastian/version": "^2.0.1" }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -4394,7 +4393,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "8.5-dev" } }, "autoload": { @@ -4420,7 +4419,7 @@ "testing", "xunit" ], - "time": "2020-01-08T08:45:45+00:00" + "time": "2020-04-23T04:39:42+00:00" }, { "name": "roave/security-advisories", @@ -4428,12 +4427,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "09afa996c68c18f49e6487b06adcb2ef27da61fa" + "reference": "81541a731da2f245a08666de73169cb5da7ac573" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/09afa996c68c18f49e6487b06adcb2ef27da61fa", - "reference": "09afa996c68c18f49e6487b06adcb2ef27da61fa", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/81541a731da2f245a08666de73169cb5da7ac573", + "reference": "81541a731da2f245a08666de73169cb5da7ac573", "shasum": "" }, "conflict": { @@ -4479,6 +4478,8 @@ "endroid/qr-code-bundle": "<3.4.2", "enshrined/svg-sanitize": "<0.13.1", "erusev/parsedown": "<1.7.2", + "ezsystems/demobundle": ">=5.4,<5.4.6.1", + "ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1", "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1|>=5.4,<5.4.11.1|>=2017.12,<2017.12.0.1", "ezsystems/ezplatform": ">=1.7,<1.7.9.1|>=1.13,<1.13.5.1|>=2.5,<2.5.4", "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6", @@ -4567,7 +4568,7 @@ "silverstripe/userforms": "<3", "simple-updates/phpwhois": "<=1", "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4", - "simplesamlphp/simplesamlphp": "<1.18.4", + "simplesamlphp/simplesamlphp": "<1.18.6", "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", "simplito/elliptic-php": "<1.0.6", "slim/slim": "<2.6", @@ -4684,7 +4685,7 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "time": "2020-04-15T04:56:51+00:00" + "time": "2020-04-23T00:01:30+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -4973,23 +4974,26 @@ }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", + "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", "shasum": "" }, "require": { - "php": "^7.0" + "php": "^7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -4997,7 +5001,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -5020,7 +5024,7 @@ "keywords": [ "global state" ], - "time": "2017-04-27T15:39:26+00:00" + "time": "2019-02-01T05:30:01+00:00" }, { "name": "sebastian/object-enumerator", @@ -5209,6 +5213,52 @@ "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "time": "2018-10-04T04:07:39+00:00" }, + { + "name": "sebastian/type", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/3aaaa15fa71d27650d62a948be022fe3b48541a3", + "reference": "3aaaa15fa71d27650d62a948be022fe3b48541a3", + "shasum": "" + }, + "require": { + "php": "^7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "time": "2019-07-02T08:10:15+00:00" + }, { "name": "sebastian/version", "version": "2.0.1", diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 088e262a9901..85f5f11c5a91 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -82,6 +82,9 @@ abstract class Common implements Storage, ILockingStorage, IVersionedStorage, IP protected $mountOptions = []; protected $owner = null; + public function __construct($parameters) { + } + /** * Remove a file or folder * diff --git a/tests/TestHelpers/EmailHelper.php b/tests/TestHelpers/EmailHelper.php index a4076bd919c4..0462da5aa288 100644 --- a/tests/TestHelpers/EmailHelper.php +++ b/tests/TestHelpers/EmailHelper.php @@ -56,7 +56,7 @@ public static function getEmails($localMailhogUrl) { * * @throws \Exception * - * @return mixed + * @return string */ public static function getBodyOfLastEmail( $localMailhogUrl, $emailAddress, $waitTimeSec = EMAIL_WAIT_TIMEOUT_SEC @@ -75,7 +75,7 @@ public static function getBodyOfLastEmail( * * @throws \Exception * - * @return mixed + * @return string */ public static function getBodyOfEmail( $localMailhogUrl, diff --git a/tests/acceptance/features/bootstrap/EmailContext.php b/tests/acceptance/features/bootstrap/EmailContext.php index 91f5f4049773..5848cf1262af 100644 --- a/tests/acceptance/features/bootstrap/EmailContext.php +++ b/tests/acceptance/features/bootstrap/EmailContext.php @@ -62,7 +62,7 @@ public function assertThatEmailContains($address, PyStringNode $content) { $expectedContent ); $emailBody = EmailHelper::getBodyOfLastEmail($this->localMailhogUrl, $address); - Assert::assertContains( + Assert::assertStringContainsString( $expectedContent, $emailBody, "The email address {$address} should have received an email with the body containing {$expectedContent} @@ -80,7 +80,7 @@ public function assertThatEmailContains($address, PyStringNode $content) { */ public function theResetEmailSenderEmailAddressShouldBe($receiverAddress, $senderAddress) { $actualSenderAddress = EmailHelper::getSenderOfEmail($this->localMailhogUrl, $receiverAddress); - Assert::assertContains( + Assert::assertStringContainsString( $senderAddress, $actualSenderAddress, "The sender address is expected to be {$senderAddress} but the actual sender is {$actualSenderAddress}" diff --git a/tests/acceptance/features/bootstrap/LoggingContext.php b/tests/acceptance/features/bootstrap/LoggingContext.php index 1275ddef3d75..b8d8c6ffd464 100644 --- a/tests/acceptance/features/bootstrap/LoggingContext.php +++ b/tests/acceptance/features/bootstrap/LoggingContext.php @@ -108,7 +108,7 @@ public function theLastLinesOfTheLogFileShouldContainEntriesWithTheseAttributes( $message ); } elseif ($comparingMode === 'containing') { - Assert::assertContains( + Assert::assertStringContainsString( $expectedLogEntry[$attribute], $logEntry[$attribute], $message ); diff --git a/tests/acceptance/features/bootstrap/OccContext.php b/tests/acceptance/features/bootstrap/OccContext.php index f4f1357b698c..02d266ff6d12 100644 --- a/tests/acceptance/features/bootstrap/OccContext.php +++ b/tests/acceptance/features/bootstrap/OccContext.php @@ -2387,7 +2387,7 @@ public function theAdministratorHasClearedTheVersionsForUser($user) { */ public function theAdministratorHasClearedTheVersionsForAllUsers() { $this->deleteAllVersionsForAllUsersUsingTheOccCommand(); - Assert::assertContains( + Assert::assertStringContainsString( "Delete all versions", \trim($this->featureContext->getStdOutOfOccCommand()), "Expected 'Delete all versions' to be contained in the output of occ command: " diff --git a/tests/acceptance/features/bootstrap/OccUsersGroupsContext.php b/tests/acceptance/features/bootstrap/OccUsersGroupsContext.php index 57753d476ad4..26b8118cce7b 100644 --- a/tests/acceptance/features/bootstrap/OccUsersGroupsContext.php +++ b/tests/acceptance/features/bootstrap/OccUsersGroupsContext.php @@ -683,7 +683,7 @@ public function theCommandOutputOfUserLastSeenShouldBeRecently() { */ public function theCommandOutputOfUserLastSeenShouldBeNever() { $lastOutput = $this->featureContext->getStdOutOfOccCommand(); - Assert::assertContains( + Assert::assertStringContainsString( "has never logged in.", $lastOutput, __METHOD__ diff --git a/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php b/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php index a3ab0c5ea929..df4be1b8acf8 100644 --- a/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php +++ b/tests/acceptance/features/bootstrap/WebUIAdminSharingSettingsContext.php @@ -496,7 +496,7 @@ public function theAdministratorDeletesAsATrustedServerUsingTheWebui($url) { */ public function aErrorMessageForTrustedServerShouldContain($text) { $msg = $this->adminSharingSettingsPage->getTrustedServerErrorMsg(); - Assert::assertContains( + Assert::assertStringContainsString( $text, $msg, __METHOD__ diff --git a/tests/acceptance/features/bootstrap/WebUIFilesContext.php b/tests/acceptance/features/bootstrap/WebUIFilesContext.php index 1da337e9d23b..613ba12be524 100644 --- a/tests/acceptance/features/bootstrap/WebUIFilesContext.php +++ b/tests/acceptance/features/bootstrap/WebUIFilesContext.php @@ -367,7 +367,7 @@ public function theThumbnailShouldBeVisibleInTheDetailsPanel() { $style, 'style attribute of details thumbnail is null' ); - Assert::assertContains( + Assert::assertStringContainsString( $this->getCurrentFolderFilePath(), $style, __METHOD__ @@ -1557,7 +1557,7 @@ public function checkIfFileFolderIsListedOnTheWebUI( $name = \implode($name); } if ($fileRow === null) { - Assert::assertContains( + Assert::assertStringContainsString( "could not find file with the name '$name'", $exceptionMessage, "found $fileLocationText when it should not be listed" @@ -1731,7 +1731,7 @@ public function itShouldNotBePossibleToDeleteFileFolderUsingTheWebUI($name) { try { $this->deleteTheFileUsingTheWebUI($name, false); } catch (ElementNotFoundException $e) { - Assert::assertContains( + Assert::assertStringContainsString( "could not find button 'Delete' in action Menu", $e->getMessage(), __METHOD__ diff --git a/tests/acceptance/features/bootstrap/WebUIGeneralContext.php b/tests/acceptance/features/bootstrap/WebUIGeneralContext.php index 3a38d396ac49..32f07c0c8c6c 100644 --- a/tests/acceptance/features/bootstrap/WebUIGeneralContext.php +++ b/tests/acceptance/features/bootstrap/WebUIGeneralContext.php @@ -547,7 +547,7 @@ public function anErrorShouldBeDisplayedOnTheGeneralExceptionPageWithTitle($titl * @return void */ public function anErrorShouldBeDisplayedOnTheGeneralErrorPageContaining($message) { - Assert::assertContains( + Assert::assertStringContainsString( $message, $this->generalExceptionPage->getExceptionMessage(), __METHOD__ diff --git a/tests/acceptance/features/bootstrap/WebUISharingContext.php b/tests/acceptance/features/bootstrap/WebUISharingContext.php index c98b156eb62b..4c603c399045 100644 --- a/tests/acceptance/features/bootstrap/WebUISharingContext.php +++ b/tests/acceptance/features/bootstrap/WebUISharingContext.php @@ -741,7 +741,7 @@ public function thePublicLinkShouldNotHaveBeenGenerated() { try { $this->publicShareTab->getLinkUrl($this->linkName); } catch (Exception $e) { - Assert::assertContains( + Assert::assertStringContainsString( "could not find link entry with the given name", $e->getMessage() ); @@ -1138,7 +1138,7 @@ public function theUserShouldNotBeAbleToSendTheShareNotificationByEmailUsingTheW } catch (Exception $e) { $errorMessage = $e->getMessage(); } - Assert::assertContains( + Assert::assertStringContainsString( "could not find notify by email button", $errorMessage, "User was not expected to be able to send the share notification by email but was" @@ -1474,14 +1474,14 @@ public function fileFolderShouldBeMarkedAsSharedBy( . "' instead." ); if ($fileOrFolder === "folder") { - Assert::assertContains( + Assert::assertStringContainsString( "folder-shared.svg", $row->findThumbnail()->getAttribute("style"), __METHOD__ . " 'folder-shared.svg' is expected to be contained in the 'style' attribute of the thumbnail of particular row." ); $detailsDialog = $this->filesPage->getDetailsDialog(); - Assert::assertContains( + Assert::assertStringContainsString( "folder-shared.svg", $detailsDialog->findThumbnail()->getAttribute("style"), __METHOD__ @@ -1668,7 +1668,7 @@ public function thePublicShouldSeeAnErrorMessageWhileAccessingLastCreatedPublicL $this->generalErrorPage->setPagePath($path); $this->generalErrorPage->open(); $actualErrorMsg = $this->generalErrorPage->getErrorMessage(); - Assert::assertContains( + Assert::assertStringContainsString( $errorMsg, $actualErrorMsg, __METHOD__ @@ -1765,7 +1765,7 @@ public function createPublicShareLink($name, $settings = null) { */ public function theTextPreviewOfThePublicLinkShouldContain($content) { $previewText = $this->publicLinkFilesPage->getPreviewText(); - Assert::assertContains( + Assert::assertStringContainsString( $content, $previewText, __METHOD__ . " file preview does not contain expected content" ); @@ -1840,7 +1840,7 @@ public function theEmailAddressShouldHaveReceivedAnEmailContainingSharedPublicLi ); $createdPublicLinks = $this->featureContext->getCreatedPublicLinks(); $lastCreatedPublicLink = \end($createdPublicLinks); - Assert::assertContains( + Assert::assertStringContainsString( $lastCreatedPublicLink["url"], $content, __METHOD__ diff --git a/tests/acceptance/features/bootstrap/WebUIUsersContext.php b/tests/acceptance/features/bootstrap/WebUIUsersContext.php index 35ba772e683c..7d904ec08aaf 100644 --- a/tests/acceptance/features/bootstrap/WebUIUsersContext.php +++ b/tests/acceptance/features/bootstrap/WebUIUsersContext.php @@ -548,7 +548,7 @@ public function theAdministratorShouldBeAbleToSeeStorageLocationOfTheseUsers( $this->featureContext->verifyTableNodeColumns($table, ['username', 'storage location']); foreach ($table as $row) { $userStorageLocation = $this->usersPage->getStorageLocationOfUser($row['username']); - Assert::assertContains( + Assert::assertStringContainsString( $row['storage location'], $userStorageLocation, __METHOD__ @@ -575,7 +575,7 @@ public function theAdministratorShouldBeAbleToSeeLastLoginOfTheseUsers( foreach ($table as $row) { $userLastLogin = $this->usersPage->getLastLoginOfUser($row['username']); - Assert::assertContains( + Assert::assertStringContainsString( $row['last login'], $userLastLogin, __METHOD__ diff --git a/tests/lib/Http/Client/WebDavClientServiceTest.php b/tests/lib/Http/Client/WebDavClientServiceTest.php index fb14196f2e9d..97c59d5ac81c 100644 --- a/tests/lib/Http/Client/WebDavClientServiceTest.php +++ b/tests/lib/Http/Client/WebDavClientServiceTest.php @@ -91,7 +91,12 @@ public function testNewClientWithProxy() { $this->assertInstanceOf(Client::class, $client); - $curlSettings = $this->readAttribute($client, 'curlSettings'); + $clientInternals = (array) $client; + // protected object properties like curlSettings have "\0*\0" prepended + $expectedKey = "\0*\0curlSettings"; + $this->assertArrayHasKey($expectedKey, $clientInternals); + $curlSettings = $clientInternals[$expectedKey]; + $this->assertArrayHasKey(CURLOPT_PROXY, $curlSettings); $this->assertEquals('proxyhost', $curlSettings[CURLOPT_PROXY]); } @@ -124,7 +129,12 @@ public function testNewClientWithProxyAndAuth() { $this->assertInstanceOf(Client::class, $client); - $curlSettings = $this->readAttribute($client, 'curlSettings'); + $clientInternals = (array) $client; + // protected object properties like curlSettings have "\0*\0" prepended + $expectedKey = "\0*\0curlSettings"; + $this->assertArrayHasKey($expectedKey, $clientInternals); + $curlSettings = $clientInternals[$expectedKey]; + $this->assertArrayHasKey(CURLOPT_PROXY, $curlSettings); $this->assertEquals('user:password@proxyhost', $curlSettings[CURLOPT_PROXY]); } diff --git a/tests/lib/SystemConfigTest.php b/tests/lib/SystemConfigTest.php index 823e99a8a9d8..98033fa359af 100644 --- a/tests/lib/SystemConfigTest.php +++ b/tests/lib/SystemConfigTest.php @@ -134,7 +134,11 @@ public function testSetValue() { $systemConfig->setValue('dbtype', 'otherDb'); $expectedConfig = $this->initialConfig; $expectedConfig['dbtype'] = 'otherDb'; - $this->assertAttributeEquals($expectedConfig, 'cache', $this->config); + $configInternals = (array) $this->config; + $expectedKey = "\0*\0cache"; + $this->assertArrayHasKey($expectedKey, $configInternals); + $cache = $configInternals[$expectedKey]; + $this->assertEquals($expectedConfig, $cache); } public function testSetValues() { @@ -148,7 +152,11 @@ public function testSetValues() { 'not_exists' => null, ]); - $this->assertAttributeEquals($this->initialConfig, 'cache', $this->config); + $configInternals = (array) $this->config; + $expectedKey = "\0*\0cache"; + $this->assertArrayHasKey($expectedKey, $configInternals); + $cache = $configInternals[$expectedKey]; + $this->assertEquals($this->initialConfig, $cache); $this->assertStringEqualsFile($this->configFile, self::TESTCONTENT); $systemConfig->setValues([ @@ -158,7 +166,11 @@ public function testSetValues() { $expectedConfig = $this->initialConfig; $expectedConfig['dbtype'] = 'otherDb'; unset($expectedConfig['license-key']); - $this->assertAttributeEquals($expectedConfig, 'cache', $this->config); + $configInternals = (array) $this->config; + $expectedKey = "\0*\0cache"; + $this->assertArrayHasKey($expectedKey, $configInternals); + $cache = $configInternals[$expectedKey]; + $this->assertEquals($expectedConfig, $cache); } public function dataGetValue() { @@ -294,7 +306,11 @@ public function testDeleteValue() { $systemConfig->deleteValue('dbtype'); $expectedConfig = $this->initialConfig; unset($expectedConfig['dbtype']); - $this->assertAttributeEquals($expectedConfig, 'cache', $this->config); + $configInternals = (array) $this->config; + $expectedKey = "\0*\0cache"; + $this->assertArrayHasKey($expectedKey, $configInternals); + $cache = $configInternals[$expectedKey]; + $this->assertEquals($expectedConfig, $cache); } public function testIsReadOnly() { diff --git a/tests/lib/Template/ResourceLocatorTest.php b/tests/lib/Template/ResourceLocatorTest.php index 1101dad4cf37..913d7f3d8375 100644 --- a/tests/lib/Template/ResourceLocatorTest.php +++ b/tests/lib/Template/ResourceLocatorTest.php @@ -57,11 +57,22 @@ public function getResourceLocator($theme, $core_map, $appsRoots) { public function testConstructor() { $locator = $this->getResourceLocator('theme', ['core'=>'map'], ['foo'=>'bar']); - $this->assertAttributeInstanceOf('OC\Theme\Theme', 'theme', $locator); - $this->assertAttributeEquals('core', 'serverroot', $locator); - $this->assertAttributeEquals(['core'=>'map'], 'mapping', $locator); - $this->assertAttributeEquals('map', 'webroot', $locator); - $this->assertAttributeEquals([], 'resources', $locator); + $locatorInternals = (array) $locator; + $expectedKey = "\0*\0theme"; + $this->assertArrayHasKey($expectedKey, $locatorInternals); + $this->assertInstanceOf('OC\Theme\Theme', $locatorInternals[$expectedKey]); + $expectedKey = "\0*\0serverroot"; + $this->assertArrayHasKey($expectedKey, $locatorInternals); + $this->assertEquals('core', $locatorInternals[$expectedKey]); + $expectedKey = "\0*\0mapping"; + $this->assertArrayHasKey($expectedKey, $locatorInternals); + $this->assertEquals(['core'=>'map'], $locatorInternals[$expectedKey]); + $expectedKey = "\0*\0webroot"; + $this->assertArrayHasKey($expectedKey, $locatorInternals); + $this->assertEquals('map', $locatorInternals[$expectedKey]); + $expectedKey = "\0*\0resources"; + $this->assertArrayHasKey($expectedKey, $locatorInternals); + $this->assertEquals([], $locatorInternals[$expectedKey]); } public function testFind() { diff --git a/vendor-bin/behat/composer.json b/vendor-bin/behat/composer.json index 4e5875827358..21b4996bc413 100644 --- a/vendor-bin/behat/composer.json +++ b/vendor-bin/behat/composer.json @@ -11,7 +11,7 @@ "symfony/translation": "^4.4", "sabre/xml": "^2.2", "guzzlehttp/guzzle": "^6.5", - "phpunit/phpunit": "^7.5", + "phpunit/phpunit": "^8.5", "zendframework/zend-ldap": "^2.10" } }