faker->words($this->faker->randomDigitNotNull()); $sorts[] = RandomCriteria::PARAM_VALUE; $attribute = $this->faker->word(); $validator = Validator::make( [$attribute => implode(',', $sorts)], [$attribute => new RandomSoleRule()] ); static::assertFalse($validator->passes()); } /** * The Random Sole Rule shall return true if the random key is not provided. * * @return void */ public function testPassesIfRandomIsNotIncluded(): void { $sorts = $this->faker->words($this->faker->randomDigitNotNull()); $attribute = $this->faker->word(); $validator = Validator::make( [$attribute => implode(',', $sorts)], [$attribute => new RandomSoleRule()] ); static::assertTrue($validator->passes()); } /** * The Random Sole Rule shall return true if the random key is the only sort provided. * * @return void */ public function testPassesIfRandomIsSoleSort(): void { $attribute = $this->faker->word(); $validator = Validator::make( [$attribute => RandomCriteria::PARAM_VALUE], [$attribute => new RandomSoleRule()] ); static::assertTrue($validator->passes()); } }