feat(test): better test script

This commit is contained in:
Phan An 2021-01-31 18:49:54 +01:00
parent 8a966242f0
commit 2ea5108e30
5 changed files with 819 additions and 176 deletions

View file

@ -4,7 +4,7 @@ namespace App\Providers;
use App\Services\Streamers\DirectStreamerInterface;
use App\Services\Streamers\ObjectStorageStreamerInterface;
use App\Services\Streamers\PHPStreamer;
use App\Services\Streamers\PhpStreamer;
use App\Services\Streamers\S3Streamer;
use App\Services\Streamers\TranscodingStreamer;
use App\Services\Streamers\TranscodingStreamerInterface;
@ -25,7 +25,7 @@ class StreamerServiceProvider extends ServiceProvider
return new XAccelRedirectStreamer();
default:
return new PHPStreamer();
return new PhpStreamer();
}
});

View file

@ -14,7 +14,7 @@ use Symfony\Component\HttpFoundation\Response;
use function DaveRandom\Resume\get_request_header;
class PHPStreamer extends Streamer implements DirectStreamerInterface
class PhpStreamer extends Streamer implements DirectStreamerInterface
{
public function stream(): void
{

View file

@ -39,7 +39,8 @@
"dms/phpunit-arraysubset-asserts": "^0.2.1",
"fakerphp/faker": "^1.13",
"slevomat/coding-standard": "^6.4",
"nunomaduro/larastan": "^0.6.11"
"nunomaduro/larastan": "^0.6.11",
"nunomaduro/collision": "^5.3"
},
"suggest": {
"ext-zip": "Allow downloading multiple songs as Zip archives"
@ -85,8 +86,8 @@
"post-create-project-cmd": [
"@php artisan key:generate"
],
"test": "phpunit --colors=always --order-by=defects",
"coverage": "phpunit --colors=always --coverage-clover=coverage.xml",
"test": "@php artisan test",
"coverage": "@php artisan test --coverage-clover=coverage.xml",
"cs": "phpcs --standard=ruleset.xml",
"cs:fix": "phpcbf --standard=ruleset.xml",
"analyze": "phpstan analyse --memory-limit 1G --configuration phpstan.neon.dist --ansi"

976
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@ namespace Tests\Integration\Factories;
use App\Factories\StreamerFactory;
use App\Models\Song;
use App\Services\Streamers\PHPStreamer;
use App\Services\Streamers\PhpStreamer;
use App\Services\Streamers\S3Streamer;
use App\Services\Streamers\TranscodingStreamer;
use App\Services\Streamers\XAccelRedirectStreamer;
@ -66,7 +66,7 @@ class StreamerFactoryTest extends TestCase
public function provideStreamingConfigData(): array
{
return [
[null, PHPStreamer::class],
[null, PhpStreamer::class],
['x-sendfile', XSendFileStreamer::class],
['x-accel-redirect', XAccelRedirectStreamer::class],
];
@ -78,7 +78,7 @@ class StreamerFactoryTest extends TestCase
* @param string|null $config
* @param string $expectedClass
*/
public function testCreatePHPStreamer($config, $expectedClass): void
public function testCreatePhpStreamer($config, $expectedClass): void
{
$this->swap(TranscodingService::class, Mockery::mock(TranscodingService::class, [
'songShouldBeTranscoded' => false,