本文整理汇总了PHP中Artisan::output方法的典型用法代码示例。如果您正苦于以下问题:PHP Artisan::output方法的具体用法?PHP Artisan::output怎么用?PHP Artisan::output使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Artisan
的用法示例。
在下文中一共展示了Artisan::output方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listRoutes
/**
* Display all routes in browser
*
*/
public function listRoutes()
{
\Route::get('routes', function () {
\Artisan::call('route:list');
return "<pre>" . \Artisan::output();
});
}
示例2: testLangFolderDoesNotExist
/**
* - Set a non existing lang folder
*/
public function testLangFolderDoesNotExist()
{
Config::set(Localization::PREFIX_LARAVEL_CONFIG . 'lang_folder_path', self::LANG_DIR_PATH . 'doesnotexist');
/** @noinspection PhpVoidFunctionResultUsedInspection */
$return = Artisan::call('localization:clear', array('--dry-run' => true));
$this->assertEquals(1, $return);
$this->assertContains('No lang folder found in your custom path:', Artisan::output());
}
示例3: testClean
/**
* @group commands
* @group file
* @todo This is slowing down unit tests?!
*/
public function testClean()
{
return;
factory(Temp::class)->create(['created_at' => Carbon::now()->subWeek()]);
factory(Temp::class, 2)->create(['created_at' => Carbon::now()->subWeek()->addDay()]);
\Artisan::call('igni:file:clear');
$this->assertNotFalse(strstr(\Artisan::output(), '1'));
}
示例4: testObsoleteKeyIsRemovedWhenSettingOption
/**
* https://github.com/potsky/laravel-localization-helpers/issues/22
*/
public function testObsoleteKeyIsRemovedWhenSettingOption()
{
Config::set(Localization::PREFIX_LARAVEL_CONFIG . 'folders', self::MOCK_DIR_PATH . '/gh22/phase1');
/** @noinspection PhpVoidFunctionResultUsedInspection */
Artisan::call('localization:missing', array('--no-interaction' => true, '--no-backup' => true, '--no-obsolete' => true, '--no-date' => true));
$this->assertContains('1 obsolete string', Artisan::output());
$lemmas = (require self::$langFile);
$this->assertArrayNotHasKey('LLH:obsolete', $lemmas);
}
示例5: testConsoleCommand
public function testConsoleCommand()
{
$stub = new StubTestCase();
$app = $stub->createApplication();
$config = (new Objectus())->slurp('tests/config/');
config($config);
\Artisan::call('larjectus:config');
$output = json_decode(\Artisan::output(), true);
$expected = ['json' => 'a test for json'];
$this->assertEquals($output['test'], $expected);
}
示例6: getFormData
public function getFormData()
{
$sampleContent = $this->readSampleEnvFile();
// By default we set debug to false and we generate an application key
\Artisan::call('key:generate', ['--show' => true]);
$key = str_replace('"', '', \Artisan::output());
$key = str_replace("\n", '', $key);
$sampleContent = str_replace('APP_KEY=SomeRandomString', 'APP_KEY=' . $key, $sampleContent);
$sampleContent = str_replace('APP_DEBUG=true', 'APP_DEBUG=false', $sampleContent);
return ['sampleContent' => $sampleContent];
}
示例7: testNgGeneratorsExist
public function testNgGeneratorsExist()
{
$exitCode = Artisan::call('list');
$output = Artisan::output();
$this->assertEquals($exitCode, 0);
$this->assertContains('ng:page', $output);
$this->assertContains('ng:dialog', $output);
$this->assertContains('ng:component', $output);
$this->assertContains('ng:service', $output);
$this->assertContains('ng:filter', $output);
$this->assertContains('ng:config', $output);
}
开发者ID:jadsalhani,项目名称:laravel5-angular-material-starter,代码行数:12,代码来源:AngularGeneratorCommandsTest.php
示例8: testObsoleteAreKept
/**
* https://github.com/potsky/laravel-localization-helpers/issues/21
*/
public function testObsoleteAreKept()
{
Config::set(Localization::PREFIX_LARAVEL_CONFIG . 'folders', self::MOCK_DIR_PATH . '/gh21/code');
// Set content in lang file with obsolete lemma
File::put(self::$langFile, self::$defaultLangWithObsoleteContent);
/** @noinspection PhpVoidFunctionResultUsedInspection */
Artisan::call('localization:missing', array('--no-interaction' => true, '--no-backup' => true, '--no-date' => true));
$this->assertContains('1 obsolete string', Artisan::output());
$lemmas = (require self::$langFile);
$this->assertArrayHasKey('LLH:obsolete', $lemmas);
$this->assertArrayNotHasKey('LLH:obsolete', $lemmas['LLH:obsolete']);
}
示例9: testSearchForRegexLemma
/**
*
*/
public function testSearchForRegexLemma()
{
/** @noinspection PhpVoidFunctionResultUsedInspection */
$return = Artisan::call('localization:find', array('lemma' => 'message\\.lemma.*', '--verbose' => true, '--short' => true, '--regex' => true));
$this->assertEquals(1, $return);
$this->assertContains('The argument is not a valid regular expression:', Artisan::output());
/** @noinspection PhpVoidFunctionResultUsedInspection */
$return = Artisan::call('localization:find', array('lemma' => '@message\\.lemma.*@', '--verbose' => true, '--short' => true, '--regex' => true));
$this->assertEquals(0, $return);
$this->assertContains('has been found in', Artisan::output());
$messageBag = new MessageBag();
$manager = new Localization($messageBag);
$trans_methods = array('trans' => array('@trans\\(\\s*(\'.*\')\\s*(,.*)*\\)@U', '@trans\\(\\s*(".*")\\s*(,.*)*\\)@U'), 'Lang::Get' => array('@Lang::Get\\(\\s*(\'.*\')\\s*(,.*)*\\)@U', '@Lang::Get\\(\\s*(".*")\\s*(,.*)*\\)@U', '@Lang::get\\(\\s*(\'.*\')\\s*(,.*)*\\)@U', '@Lang::get\\(\\s*(".*")\\s*(,.*)*\\)@U'), 'trans_choice' => array('@trans_choice\\(\\s*(\'.*\')\\s*,.*\\)@U', '@trans_choice\\(\\s*(".*")\\s*,.*\\)@U'), 'Lang::choice' => array('@Lang::choice\\(\\s*(\'.*\')\\s*,.*\\)@U', '@Lang::choice\\(\\s*(".*")\\s*,.*\\)@U'), '@lang' => array('@\\@lang\\(\\s*(\'.*\')\\s*(,.*)*\\)@U', '@\\@lang\\(\\s*(".*")\\s*(,.*)*\\)@U'), '@choice' => array('@\\@choice\\(\\s*(\'.*\')\\s*,.*\\)@U', '@\\@choice\\(\\s*(".*")\\s*,.*\\)@U'));
$return = $manager->findLemma('not a valid regex', $manager->getPath(self::MOCK_DIR_PATH_GLOBAL), $trans_methods, true, true);
$messages = $messageBag->getMessages();
$this->assertFalse($return);
$this->assertContains('The argument is not a valid regular expression:', $messages[0][1]);
}
示例10: function
$grouped[$sub[$pidKey]][] = $sub;
}
// print_r($grouped);
// exit();
// return $grouped ;
$fnBuilder = function ($siblings) use(&$fnBuilder, $grouped, $idKey) {
foreach ($siblings as $k => $sibling) {
$id = $sibling[$idKey];
//priksa apakah punya turunan atau tidak
if (isset($grouped[$id])) {
$sibling['children'] = $fnBuilder($grouped[$id]);
$sibling['text'] = '<a data-link="">' . $sibling['text'] . '</a>';
//turunan
// print_r($sibling);
// exit();
}
//tidak punya turunan
$sibling['text'] = '<a data-link="' . $sibling['link'] . '"data-idgrid="' . $sibling['idgrid'] . '">' . $sibling['text'] . '</a>';
$siblings[$k] = $sibling;
}
return $siblings;
};
$tree = $fnBuilder($grouped[0]);
return $tree;
}
Route::get('mr', function () {
$exitCode = Artisan::call('route:list', ['name']);
// dd($exitCode);
// Artisan::call('help');
dd(Artisan::output());
});
示例11: testKeygenCommand
/**
* Tests the Cron keygen command
*
* @covers \Liebig\Cron\KeygenCommand
*/
public function testKeygenCommand()
{
$commandOutput = '';
if ($this->laravelVersion >= 5) {
\Artisan::call('cron:keygen', array());
$commandOutput = \Artisan::output();
} else {
$outputStream = new \Symfony\Component\Console\Output\StreamOutput(fopen('php://output', 'w'));
ob_start();
\Artisan::call('cron:keygen', array(), $outputStream);
$commandOutput = ob_get_clean();
}
$commandOutput = str_replace("\r", '', $commandOutput);
$commandOutput = str_replace("\n", '', $commandOutput);
$this->assertEquals(32, strlen($commandOutput));
$this->assertTrue(ctype_alnum($commandOutput));
if ($this->laravelVersion >= 5) {
\Artisan::call('cron:keygen', array('length' => 5));
$commandOutput = \Artisan::output();
} else {
$outputStream = new \Symfony\Component\Console\Output\StreamOutput(fopen('php://output', 'w'));
ob_start();
\Artisan::call('cron:keygen', array('length' => 5), $outputStream);
$commandOutput = ob_get_clean();
}
$commandOutput = str_replace("\r", '', $commandOutput);
$commandOutput = str_replace("\n", '', $commandOutput);
$this->assertEquals(5, strlen($commandOutput));
$this->assertTrue(ctype_alnum($commandOutput));
}
示例12: function
<?php
/*
|--------------------------------------------------------------------------
| Frontend Routes
|--------------------------------------------------------------------------
*/
// Route::get('users/{user}', function (AppUser $user) {
// return $user;
// })
Route::get('routes', function () {
\Artisan::call('route:list');
return '<pre>' . \Artisan::output() . '</pre>';
});
Route::get('/r', function () {
function philsroutes()
{
$routeCollection = Route::getRoutes();
echo "<table style='width:100%'>";
echo "<tr>";
echo "<td width='10%'><h4>HTTP Method</h4></td>";
echo "<td width='10%'><h4>Route</h4></td>";
echo "<td width='80%'><h4>Corresponding Action</h4></td>";
echo "</tr>";
foreach ($routeCollection as $value) {
echo "<tr>";
echo "<td>" . $value->getMethods()[0] . "</td>";
echo "<td><a href='" . $value->getPath() . "' target='_blank'>" . $value->getPath() . "</a> </td>";
echo "<td>" . $value->getActionName() . "</td>";
echo "</tr>";
}
示例13: function
Route::post('/tags', ['middleware' => 'auth', 'uses' => 'TagController@save']);
//Rotas para PostResource
Route::get('/posts', 'PostController@index');
Route::get('/posts/getTitles', 'PostController@getTitles');
Route::get('/posts/{id}', 'PostController@show');
Route::post('/posts', ['middleware' => 'auth', 'uses' => 'PostController@save']);
//Rotas para comments
Route::get('/comments/post/{id}', 'CommentController@getCommentsByPost');
Route::post('/comments', ['middleware' => 'auth', 'uses' => 'CommentController@save']);
//Rotas para UserResource
Route::get('/users', 'UserController@index');
Route::get('/users/{id}', 'UserController@show');
Route::post('/users', ['middleware' => 'auth', 'uses' => 'UserController@saveFromRequest']);
Route::get('routes', function () {
\Artisan::call('route:list');
return "<pre>" . \Artisan::output();
});
//Display all SQL executed in Eloquent
// in a storage/logs/sql.log file
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
\DB::listen(function ($sql, $bindings, $time) {
if (App::environment() == "local") {
$xsql = explode("?", $sql);
$nsql = "";
for ($i = 0; $i < count($xsql) - 1; $i++) {
$nsql .= $xsql[$i] . $bindings[$i];
}
$view_log = new Logger("SQL");
$view_log->pushHandler(new StreamHandler(storage_path() . '/logs/sql.log'));
$view_log->addInfo($nsql ?: $sql);
示例14: testSilent
/**
*
*/
public function testSilent()
{
/** @noinspection PhpVoidFunctionResultUsedInspection */
$return = Artisan::call('localization:missing', array('--no-interaction' => true, '--silent' => true));
// Exit code is 1 because there are new lemma to translate
$this->assertEquals(1, $return);
$this->assertEmpty(Artisan::output());
}
示例15: function
Route::get('students', 'TeacherController@students');
});
});
Route::group(['prefix' => 'student', 'middleware' => ['auth', 'student']], function () {
Route::get('grades', 'StudentController@index');
});
Route::group(['prefix' => 'programhead'], function () {
Route::get('approve', 'ProgramHeadController@index');
Route::post('delete', 'ProgramHeadController@delete');
Route::delete('delete', 'ProgramHeadController@destroy');
Route::post('approve', 'ProgramHeadController@approveGrades');
});
Route::group(['prefix' => 'developer'], function () {
Route::get('/', 'DeveloperController@index');
Route::post('/', 'DeveloperController@store');
Route::get('run-seed', function () {
Artisan::call('db:seed', ['--force' => 'y']);
return Artisan::output();
});
Route::get('run-migrate', function () {
Artisan::call('migrate', ['--force' => 'y']);
return Artisan::output();
});
Route::get('run-rollback', function () {
Artisan::call('migrate:rollback', ['--force' => 'y']);
return Artisan::output();
});
Route::get('table', 'DeveloperController@getTable');
Route::post('seed', 'DeveloperController@seed');
});
});