toActionResult(); static::assertTrue($result->hasFailed()); } /** * The Action result has failed if any uploads have returned false. * * @return void */ public function testFailed(): void { $uploads = []; foreach (range(0, $this->faker->randomDigitNotNull()) as $ignored) { $uploads[$this->faker->word()] = $this->faker->filePath(); } foreach (range(0, $this->faker->randomDigitNotNull()) as $ignored) { $uploads[$this->faker->word()] = false; } $uploadResults = new UploadResults($uploads); $result = $uploadResults->toActionResult(); static::assertTrue($result->hasFailed()); } /** * The Action result has passed if all uploads have returned the file path. * * @return void */ public function testPassed(): void { $uploads = []; foreach (range(0, $this->faker->randomDigitNotNull()) as $ignored) { $uploads[$this->faker->word()] = $this->faker->filePath(); } $uploadResults = new UploadResults($uploads); $result = $uploadResults->toActionResult(); static::assertTrue(ActionStatus::PASSED === $result->getStatus()); } }