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([ 'chapters' => [ $this->faker->word() => $this->faker->word(), ], ])), ]); $validator = Validator::make( ['file' => $file], ['file' => new ExtraneousChaptersFormatRule()], ); static::assertFalse($validator->passes()); Process::assertRan(SubmissionRule::formatFfprobeCommand($file)); } /** * The Extraneous Chapters Format Rule shall pass if the chapter data is empty. * * @return void */ public function testPassesWhenChapterDataIsEmpty(): void { $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([ 'chapters' => [], ])), ]); $validator = Validator::make( ['file' => $file], ['file' => new ExtraneousChaptersFormatRule()], ); static::assertTrue($validator->passes()); Process::assertRan(SubmissionRule::formatFfprobeCommand($file)); } }