diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..d7319de --- /dev/null +++ b/.env.example @@ -0,0 +1,6 @@ +AWS_ACCESS_KEY_ID=xxxxxxx +AWS_SECRET_ACCESS_KEY=xxxxxxx +AWS_DEFAULT_REGION=us-east-1 +AWS_MEDIACONVERT_ACCOUNT_URL=https://xxxxxxxxx.mediaconvert.us-east-1.amazonaws.com +AWS_IAM_ARN=arn:aws:iam::xxxxxxx:role/MediaConvert_Default_Role +AWS_QUEUE_ARN=arn:aws:mediaconvert:us-east-1:xxxxxxx:queues/Default diff --git a/.gitattributes b/.gitattributes index 03751b3..d32a774 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8,3 +8,5 @@ /.scrutinizer.yml export-ignore /tests export-ignore /.editorconfig export-ignore +/.env export-ignore +/.env.example export-ignore diff --git a/config/config.php b/config/config.php index a023a0a..20304af 100644 --- a/config/config.php +++ b/config/config.php @@ -67,7 +67,7 @@ 'settings' => [ 'OutputGroups' => [ - // first thumbnails for sprite generation + // thumbnail generation [ 'CustomName' => 'Thumbnails', 'Name' => 'File Group', @@ -114,7 +114,7 @@ ], ], - // third mp4 + // optimize-mp4 output setting [ 'CustomName' => 'MP4', 'Name' => 'File Group', diff --git a/tests/MediaConverterTest.php b/tests/MediaConverterTest.php index dd85274..a8a46a9 100644 --- a/tests/MediaConverterTest.php +++ b/tests/MediaConverterTest.php @@ -1,5 +1,7 @@ initializeSettings(); }); -it('it can successfully initialize settings', function () { +it('can successfully initialize settings', function () { $this->assertTrue(is_array($this->settings)); }); -it('it can successfully create a job', function () { - $response = Meema\MediaConverter\Facades\MediaConvert::createJob($this->settings, []); +it('can successfully create a job', function () { + $response = MediaConvert::createJob($this->settings); $this->assertEquals($response['@metadata']['statusCode'], 201); }); -it('it can successfully get a job', function () { - // Just a fixed Id fetched from aws media convert jobs +it('can successfully get a job', function () { + // just a hardcoded job ID retrieved from one of the AWS MediaConvert jobs $jobId = '1615614565083-g1cgjm'; - $response = Meema\MediaConverter\Facades\MediaConvert::getJob($jobId); + $response = MediaConvert::getJob($jobId); $this->assertEquals($response['@metadata']['statusCode'], 200); $this->assertEquals($response['Job']['Id'], $jobId); }); - it('it can successfully cancel a job', function () { - $job = Meema\MediaConverter\Facades\MediaConvert::createJob($this->settings, []); + it('can successfully cancel a job', function () { + $job = MediaConvert::createJob($this->settings, []); - $response = Meema\MediaConverter\Facades\MediaConvert::cancelJob($job['Job']['Id']); + $response = MediaConvert::cancelJob($job['Job']['Id']); $this->assertEquals($response['@metadata']['statusCode'], 202); }); - it('it can successfully list jobs', function () { - $response = Meema\MediaConverter\Facades\MediaConvert::listJobs([]); + it('can successfully list jobs', function () { + $response = MediaConvert::listJobs([]); $this->assertEquals($response['@metadata']['statusCode'], 200); $this->assertTrue(count($response) > 0); diff --git a/tests/MediaConverterTestCase.php b/tests/MediaConverterTestCase.php index 6acf688..a514486 100644 --- a/tests/MediaConverterTestCase.php +++ b/tests/MediaConverterTestCase.php @@ -7,11 +7,11 @@ class MediaConverterTestCase extends TestCase { - public $settings = []; + public array $settings = []; - public $sizes = []; + public array $sizes = []; - protected function getPackageProviders($app) + protected function getPackageProviders($app): array { return [MediaConverterServiceProvider::class]; } diff --git a/tests/config/job.json b/tests/config/job.json index 3daadc8..4a6b4a8 100644 --- a/tests/config/job.json +++ b/tests/config/job.json @@ -34,7 +34,7 @@ "OutputGroupSettings":{ "Type":"FILE_GROUP_SETTINGS", "FileGroupSettings":{ - "Destination":"s3:\/\/meema-stage\/\/thumbnails\/", + "Destination":"s3:\/\/meema-stage\/\/pest-tests\/\/thumbnails\/", "DestinationSettings":{ "S3Settings":{ "AccessControl":{ @@ -131,7 +131,7 @@ "OutputGroupSettings":{ "Type":"FILE_GROUP_SETTINGS", "FileGroupSettings":{ - "Destination":"s3:\/\/meema-stage\/\/mp4\/", + "Destination":"s3:\/\/meema-stage\/\/pest-tests\/\/mp4\/", "DestinationSettings":{ "S3Settings":{ "AccessControl":{ @@ -162,7 +162,7 @@ "DeblockFilter":"DISABLED", "DenoiseFilter":"DISABLED", "TimecodeSource":"EMBEDDED", - "FileInput":"s3:\/\/meema-stage\/test-me.mp4" + "FileInput":"s3:\/\/meema-stage\/pest-tests\/\/test-me.mp4" } ] }