create($this->faker->word().'.webm', $this->faker->randomDigitNotNull()); Process::fake([ SubmissionRule::formatLoudnessCommand($file) => Process::result(errorOutput: json_encode([ 'input_i' => $this->faker->randomFloat(), 'input_tp' => $this->faker->randomFloat(), 'input_lra' => $this->faker->randomFloat(), 'input_thresh' => $this->faker->randomFloat(), 'output_i' => $this->faker->randomFloat(), 'output_tp' => $this->faker->randomFloat(), 'output_lra' => $this->faker->randomFloat(), 'output_thresh' => $this->faker->randomFloat(), 'normalization_type' => 'dynamic', 'target_offset' => $this->faker->randomFloat(), ])), SubmissionRule::formatFfprobeCommand($file) => Process::result(json_encode([ 'streams' => [ 0 => [ 'codec_type' => 'video', 'codec_name' => $this->faker->randomDigitNot(2), ], ], ])), ]); $validator = Validator::make( ['file' => $file], ['file' => new VideoCodecStreamRule()], ); static::assertFalse($validator->passes()); Process::assertRan(SubmissionRule::formatFfprobeCommand($file)); } /** * The Video Codec Stream Rule shall pass if the video codec is vp9. * * @return void */ public function testPassesWhenCodecIsVp9(): void { Feature::activate(FeatureConstants::VIDEO_CODEC_STREAM, 'vp9'); $file = UploadedFile::fake()->create($this->faker->word().'.webm', $this->faker->randomDigitNotNull()); Process::fake([ SubmissionRule::formatLoudnessCommand($file) => Process::result(errorOutput: json_encode([ 'input_i' => $this->faker->randomFloat(), 'input_tp' => $this->faker->randomFloat(), 'input_lra' => $this->faker->randomFloat(), 'input_thresh' => $this->faker->randomFloat(), 'output_i' => $this->faker->randomFloat(), 'output_tp' => $this->faker->randomFloat(), 'output_lra' => $this->faker->randomFloat(), 'output_thresh' => $this->faker->randomFloat(), 'normalization_type' => 'dynamic', 'target_offset' => $this->faker->randomFloat(), ])), SubmissionRule::formatFfprobeCommand($file) => Process::result(json_encode([ 'streams' => [ 0 => [ 'codec_type' => 'video', 'codec_name' => 'vp9', ], ], ])), ]); $validator = Validator::make( ['file' => $file], ['file' => new VideoCodecStreamRule()], ); static::assertTrue($validator->passes()); Process::assertRan(SubmissionRule::formatFfprobeCommand($file)); } }