faker->word(); $rule = new DistinctIgnoringDirectionRule(); $sorts = collect()->pad($this->faker->numberBetween(2, 9), $key); static::assertFalse($rule->passes($this->faker->word(), $sorts->join(','))); } /** * The Distinct Ignoring Direction Rule shall return false if there exists duplicate sort keys of differing directions. * * @return void */ public function testFailsIfDuplicateSortDifferentDirection(): void { $key = $this->faker->word(); $rule = new DistinctIgnoringDirectionRule(); $sort = new Sort($key); $sorts = []; foreach (Direction::getInstances() as $direction) { $sorts[] = $sort->format($direction); } static::assertFalse($rule->passes($this->faker->word(), implode(',', $sorts))); } /** * The Distinct Ignoring Direction Rule shall return true if there exist no duplicate sort keys. * * @return void */ public function testPassesIfNoDuplicates(): void { $rule = new DistinctIgnoringDirectionRule(); $sorts = collect($this->faker->words($this->faker->randomDigitNotNull()))->unique(); static::assertTrue($rule->passes($this->faker->word(), $sorts->join(','))); } }