output() публичный статический Метод

Get the output for the last run command.
public static output ( ) : string
Результат string
 /**
  * Display all routes in browser
  *
  */
 public function listRoutes()
 {
     \Route::get('routes', function () {
         \Artisan::call('route:list');
         return "<pre>" . \Artisan::output();
     });
 }
 /**
  * - 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
0
 /**
  * @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'));
 }
 /**
  * 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
0
 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);
 }
 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];
 }
 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);
 }
 /**
  * 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']);
 }
 /**
  *
  */
 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
0
        $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
0
 /**
  *  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
0
<?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
0
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);
 /**
  *
  */
 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
0
            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');
    });
});
Пример #16
0
<?php

Route::get('artisan/deploy', function () {
    Artisan::call('deploy');
    return dd(Artisan::output());
});
Route::get('artisan/seed', function () {
    Artisan::call('seed');
    return dd(Artisan::output());
});
<?php

echo "Coaster Framework: Running database migrations\n";
Artisan::call('migrate', ['--path' => '/vendor/web-feet/coasterframework/database/migrations']);
echo Artisan::output();