Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: install vfsStream to run testMimeTypeIcon again #38632

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ steps:
image: ghcr.io/nextcloud/continuous-integration-php8.0:latest
commands:
- bash tests/drone-run-php-tests.sh || exit 0
- composer install --working-dir=build/integration
- NOCOVERAGE=true TEST_SELECTION=NODB ./autotest.sh sqlite

services:
Expand Down
3 changes: 2 additions & 1 deletion build/integration/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"guzzlehttp/guzzle": "7.6.1",
"jarnaiz/behat-junit-formatter": "^1.3",
"sabre/dav": "4.4.0",
"symfony/event-dispatcher": "~5.3"
"symfony/event-dispatcher": "~5.3",
"mikey179/vfsstream": "^1.6"
}
}
53 changes: 52 additions & 1 deletion build/integration/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 14 additions & 13 deletions tests/lib/Files/Type/DetectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public function testMimeTypeIcon() {
if (!class_exists('org\\bovigo\\vfs\\vfsStream')) {
$this->markTestSkipped('Package vfsStream not installed');
}

$confDir = \org\bovigo\vfs\vfsStream::setup();
$mimetypealiases_dist = \org\bovigo\vfs\vfsStream::newFile('mimetypealiases.dist.json')->at($confDir);

Expand All @@ -157,7 +158,7 @@ public function testMimeTypeIcon() {
//Only call the url generator once
$urlGenerator->expects($this->once())
->method('imagePath')
->with($this->equalTo('core'), $this->equalTo('filetypes/folder.png'))
->with($this->equalTo('core'), $this->equalTo('filetypes/folder.svg'))
->willReturn('folder.svg');

$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
Expand All @@ -176,7 +177,7 @@ public function testMimeTypeIcon() {
//Only call the url generator once
$urlGenerator->expects($this->once())
->method('imagePath')
->with($this->equalTo('core'), $this->equalTo('filetypes/folder-shared.png'))
->with($this->equalTo('core'), $this->equalTo('filetypes/folder-shared.svg'))
->willReturn('folder-shared.svg');

$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
Expand All @@ -196,7 +197,7 @@ public function testMimeTypeIcon() {
//Only call the url generator once
$urlGenerator->expects($this->once())
->method('imagePath')
->with($this->equalTo('core'), $this->equalTo('filetypes/folder-external.png'))
->with($this->equalTo('core'), $this->equalTo('filetypes/folder-external.svg'))
->willReturn('folder-external.svg');

$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
Expand All @@ -216,7 +217,7 @@ public function testMimeTypeIcon() {
//Only call the url generator once
$urlGenerator->expects($this->once())
->method('imagePath')
->with($this->equalTo('core'), $this->equalTo('filetypes/my-type.png'))
->with($this->equalTo('core'), $this->equalTo('filetypes/my-type.svg'))
->willReturn('my-type.svg');

$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
Expand All @@ -237,12 +238,12 @@ public function testMimeTypeIcon() {
$urlGenerator->expects($this->exactly(2))
->method('imagePath')
->withConsecutive(
[$this->equalTo('core'), $this->equalTo('filetypes/my-type.png')],
[$this->equalTo('core'), $this->equalTo('filetypes/my.png')]
[$this->equalTo('core'), $this->equalTo('filetypes/my-type.svg')],
[$this->equalTo('core'), $this->equalTo('filetypes/my.svg')]
)
->willReturnCallback(
function ($appName, $file) {
if ($file === 'filetypes/my.png') {
if ($file === 'filetypes/my.svg') {
return 'my.svg';
}
throw new \RuntimeException();
Expand All @@ -267,13 +268,13 @@ function ($appName, $file) {
$urlGenerator->expects($this->exactly(3))
->method('imagePath')
->withConsecutive(
[$this->equalTo('core'), $this->equalTo('filetypes/foo-bar.png')],
[$this->equalTo('core'), $this->equalTo('filetypes/foo.png')],
[$this->equalTo('core'), $this->equalTo('filetypes/file.png')]
[$this->equalTo('core'), $this->equalTo('filetypes/foo-bar.svg')],
[$this->equalTo('core'), $this->equalTo('filetypes/foo.svg')],
[$this->equalTo('core'), $this->equalTo('filetypes/file.svg')]
)
->willReturnCallback(
function ($appName, $file) {
if ($file === 'filetypes/file.png') {
if ($file === 'filetypes/file.svg') {
return 'file.svg';
}
throw new \RuntimeException();
Expand All @@ -296,7 +297,7 @@ function ($appName, $file) {
//Only call the url generator once
$urlGenerator->expects($this->once())
->method('imagePath')
->with($this->equalTo('core'), $this->equalTo('filetypes/foo-bar.png'))
->with($this->equalTo('core'), $this->equalTo('filetypes/foo-bar.svg'))
->willReturn('foo-bar.svg');

$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
Expand All @@ -322,7 +323,7 @@ function ($appName, $file) {
//Only call the url generator once
$urlGenerator->expects($this->once())
->method('imagePath')
->with($this->equalTo('core'), $this->equalTo('filetypes/foobar-baz.png'))
->with($this->equalTo('core'), $this->equalTo('filetypes/foobar-baz.svg'))
->willReturn('foobar-baz.svg');

$detection = new Detection($urlGenerator, $logger, $confDir->url(), $confDir->url());
Expand Down