X Tutup
Skip to content

Fix files:checksums:verify for a single file#39683

Merged
phil-davis merged 1 commit intomasterfrom
enterprise-4946
Jan 12, 2022
Merged

Fix files:checksums:verify for a single file#39683
phil-davis merged 1 commit intomasterfrom
enterprise-4946

Conversation

@phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Jan 12, 2022

Description

files:checksums:verify fails if run against just a single file (specify -u someuser -p somefile.ext)

I added a unit test that does this, and it fails as follows:

/home/phil/git/owncloud/core/lib/composer/phpunit/phpunit/phpunit --configuration phpunit-autotest.xml --log-junit autotest-results-sqlite.xml ../apps/files/tests/Command/VerifyChecksumsTest.php 
PHPUnit 9.5.11 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.27
Configuration: phpunit-autotest.xml

......E.....                                                      12 / 12 (100%)

Time: 00:00.709, Memory: 28.00 MB

There was 1 error:

1) OCA\Files\Tests\Command\VerifyChecksumsTest::testSingleFileInGivenPathArgumentIsRepaired
Error: Call to undefined method OC\Files\Node\File::getDirectoryListing()

/home/phil/git/owncloud/core/apps/files/lib/Command/VerifyChecksums.php:214
/home/phil/git/owncloud/core/apps/files/lib/Command/VerifyChecksums.php:121
/home/phil/git/owncloud/core/lib/composer/symfony/console/Command/Command.php:255
/home/phil/git/owncloud/core/lib/composer/symfony/console/Tester/CommandTester.php:76
/home/phil/git/owncloud/core/apps/files/tests/Command/VerifyChecksumsTest.php:290

ERRORS!
Tests: 12, Assertions: 47, Errors: 1.
make: *** [Makefile:195: test-php-unit] Error 2

The test passes with the fixed code.

Related Issue

How Has This Been Tested?

Added a unit test that fails without the fix, and passes with the fix.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@phil-davis phil-davis merged commit 66ed39d into master Jan 12, 2022
@delete-merged-branch delete-merged-branch bot deleted the enterprise-4946 branch January 12, 2022 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

X Tutup