本文整理匯總了PHP中Illuminate\Support\Facades\App::runningUnitTests方法的典型用法代碼示例。如果您正苦於以下問題:PHP App::runningUnitTests方法的具體用法?PHP App::runningUnitTests怎麽用?PHP App::runningUnitTests使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\App
的用法示例。
在下文中一共展示了App::runningUnitTests方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInterfaceLocale
public function getInterfaceLocale()
{
$locale = Input::get("l");
$translating = Input::get("t");
$primary = Input::get("p");
$displayLocales = Input::get("d");
$display = implode(',', $displayLocales ?: []);
App::setLocale($locale);
Cookie::queue($this->cookieName(self::COOKIE_LANG_LOCALE), $locale, 60 * 24 * 365 * 1);
Cookie::queue($this->cookieName(self::COOKIE_TRANS_LOCALE), $translating, 60 * 24 * 365 * 1);
Cookie::queue($this->cookieName(self::COOKIE_PRIM_LOCALE), $primary, 60 * 24 * 365 * 1);
Cookie::queue($this->cookieName(self::COOKIE_DISP_LOCALES), $display, 60 * 24 * 365 * 1);
if (App::runningUnitTests()) {
return Redirect::to('/');
}
return !is_null(Request::header('referer')) ? Redirect::back() : Redirect::to('/');
}
示例2: resetDatabase
private function resetDatabase()
{
$env = App::environment();
$this->output->writeln("Truncating tables in {$env} environment");
if (App::isLocal()) {
foreach ($this->tables as $table) {
$this->output->writeln("Truncating {$table}");
DB::statement('TRUNCATE TABLE ' . $table . ' CASCADE;');
}
} elseif (App::runningUnitTests()) {
Eloquent::unguard();
foreach ($this->tables as $table) {
$this->output->writeln("Truncating {$table}");
DB::statement('TRUNCATE TABLE ' . $table . ' CASCADE;');
}
}
}