/** @test */ public function there_are_no_regex_collisions() { $crawlers = new Crawlers(); foreach ($crawlers->getAll() as $key1 => $regex) { foreach ($crawlers->getAll() as $key2 => $compare) { // Dont check this regex against itself if ($key1 != $key2) { preg_match('/' . $regex . '/i', stripslashes($compare), $matches); $this->assertEmpty($matches, $regex . ' collided with ' . $compare); } } } }
/** * Build the user agent regex. * * @return string */ public function getRegex() { return '(' . implode('|', $this->crawlers->getAll()) . ')'; }