Fix tests after we corrected the media URLs
The media URLs have a path that starts `/storage/`.
This commit is contained in:
parent
d7da42b626
commit
43447ac47b
2 changed files with 19 additions and 18 deletions
|
@ -93,7 +93,7 @@ class MicropubMediaTest extends TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
||||||
$filename = Str::chopStart($path, '/media/');
|
$filename = Str::chopStart($path, '/storage/media/');
|
||||||
|
|
||||||
$lastUploadResponse = $this->get(
|
$lastUploadResponse = $this->get(
|
||||||
'/api/media?q=last',
|
'/api/media?q=last',
|
||||||
|
@ -122,7 +122,7 @@ class MicropubMediaTest extends TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
||||||
$filename = Str::chopStart($path, '/media/');
|
$filename = Str::chopStart($path, '/storage/media/');
|
||||||
|
|
||||||
$sourceUploadResponse = $this->get(
|
$sourceUploadResponse = $this->get(
|
||||||
'/api/media?q=source',
|
'/api/media?q=source',
|
||||||
|
@ -154,7 +154,7 @@ class MicropubMediaTest extends TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
||||||
$filename = Str::chopStart($path, '/media/');
|
$filename = Str::chopStart($path, '/storage/media/');
|
||||||
|
|
||||||
$sourceUploadResponse = $this->get(
|
$sourceUploadResponse = $this->get(
|
||||||
'/api/media?q=source&limit=1',
|
'/api/media?q=source&limit=1',
|
||||||
|
@ -261,11 +261,12 @@ class MicropubMediaTest extends TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
||||||
$filename = Str::chopStart($path, '/media/');
|
dump($path);
|
||||||
|
$filename = Str::chopStart($path, '/storage/');
|
||||||
Queue::assertPushed(ProcessMedia::class);
|
Queue::assertPushed(ProcessMedia::class);
|
||||||
Storage::disk('local')->assertExists($path);
|
Storage::disk('local')->assertExists($filename);
|
||||||
// now remove file
|
// now remove file
|
||||||
unlink(storage_path('app/media/') . $filename);
|
unlink(storage_path('app/') . $filename);
|
||||||
$this->removeDirIfEmpty(storage_path('app/media'));
|
$this->removeDirIfEmpty(storage_path('app/media'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,11 +285,11 @@ class MicropubMediaTest extends TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
||||||
$filename = Str::chopStart($path, '/media/');
|
$filename = Str::chopStart($path, '/storage/');
|
||||||
Queue::assertPushed(ProcessMedia::class);
|
Queue::assertPushed(ProcessMedia::class);
|
||||||
Storage::disk('local')->assertExists($path);
|
Storage::disk('local')->assertExists($filename);
|
||||||
// now remove file
|
// now remove file
|
||||||
unlink(storage_path('app/media/') . $filename);
|
unlink(storage_path('app/') . $filename);
|
||||||
$this->removeDirIfEmpty(storage_path('app/media'));
|
$this->removeDirIfEmpty(storage_path('app/media'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,11 +308,11 @@ class MicropubMediaTest extends TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
||||||
$filename = Str::chopStart($path, '/media/');
|
$filename = Str::chopStart($path, '/storage/');
|
||||||
Queue::assertPushed(ProcessMedia::class);
|
Queue::assertPushed(ProcessMedia::class);
|
||||||
Storage::disk('local')->assertExists($path);
|
Storage::disk('local')->assertExists($filename);
|
||||||
// now remove file
|
// now remove file
|
||||||
unlink(storage_path('app/media/') . $filename);
|
unlink(storage_path('app/') . $filename);
|
||||||
$this->removeDirIfEmpty(storage_path('app/media'));
|
$this->removeDirIfEmpty(storage_path('app/media'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,11 +330,11 @@ class MicropubMediaTest extends TestCase
|
||||||
);
|
);
|
||||||
|
|
||||||
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
$path = parse_url($response->headers->get('Location'), PHP_URL_PATH);
|
||||||
$filename = Str::chopStart($path, '/media/');
|
$filename = Str::chopStart($path, '/storage/');
|
||||||
Queue::assertPushed(ProcessMedia::class);
|
Queue::assertPushed(ProcessMedia::class);
|
||||||
Storage::disk('local')->assertExists($path);
|
Storage::disk('local')->assertExists($filename);
|
||||||
// now remove file
|
// now remove file
|
||||||
unlink(storage_path('app/media/') . $filename);
|
unlink(storage_path('app/') . $filename);
|
||||||
$this->removeDirIfEmpty(storage_path('app/media'));
|
$this->removeDirIfEmpty(storage_path('app/media'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,7 @@ class NotesTest extends TestCase
|
||||||
$note->media()->save($media);
|
$note->media()->save($media);
|
||||||
|
|
||||||
$expected = 'A nice image
|
$expected = 'A nice image
|
||||||
<img src="' . config('app.url') . '/test.png" alt="">';
|
<img src="' . config('app.url') . '/storage/test.png" alt="">';
|
||||||
$this->assertEquals($expected, $note->content);
|
$this->assertEquals($expected, $note->content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,7 +340,7 @@ class NotesTest extends TestCase
|
||||||
$note->media()->save($media);
|
$note->media()->save($media);
|
||||||
|
|
||||||
$expected = 'A nice video
|
$expected = 'A nice video
|
||||||
<video src="' . config('app.url') . '/test.mkv">';
|
<video src="' . config('app.url') . '/storage/test.mkv">';
|
||||||
$this->assertEquals($expected, $note->content);
|
$this->assertEquals($expected, $note->content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +357,7 @@ class NotesTest extends TestCase
|
||||||
$note->media()->save($media);
|
$note->media()->save($media);
|
||||||
|
|
||||||
$expected = 'Some nice audio
|
$expected = 'Some nice audio
|
||||||
<audio src="' . config('app.url') . '/test.flac">';
|
<audio src="' . config('app.url') . '/storage/test.flac">';
|
||||||
$this->assertEquals($expected, $note->content);
|
$this->assertEquals($expected, $note->content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue