/** * testCountByInstanceId * * @return void */ public function testCountByInstanceId() { $repo = new InstanceRouteRepository($this->conn); $query = $this->query; $query->shouldReceive('where')->andReturn($query); $query->shouldReceive('count')->andReturn(1); $dummyFilter = function ($query) { return $query->where('id', '=', 'test'); }; $affected = $repo->countByInstanceId('freeboard', $dummyFilter); $this->assertEquals(1, $affected); }
/** * usableUrl * * @param string $siteKey site key * @param string $url url * * @return bool */ public function usableUrl($siteKey, $url) { $checkIncludingSlash = strpos($url, '/'); if ($checkIncludingSlash !== false) { return false; } $configUrl = [$this->illuminateConfig->get('xe.routing.fixedPrefix'), $this->illuminateConfig->get('xe.routing.settingsPrefix')]; if ($this->instanceRouteRepository->countByUrl($siteKey, $url) > 0 or in_array($url, static::$protectedUrl) or in_array($url, $configUrl)) { return false; } else { return true; } }