public function testWithInvalidFilter() { $this->initDB(); $exitCode = Artisan::call('ticket:show', ['ticket' => 'xxx']); $this->assertEquals($exitCode, 0); $this->assertContains('No matching ticket was found.', Artisan::output()); }
public function testNetBlockListCommandWithValidFilter() { $exitCode = Artisan::call('netblock:list', ['--filter' => '192.168.1.0']); $this->assertEquals($exitCode, 0); $this->assertContains('ISP Business Internet', Artisan::output()); $this->assertNotContains('Customer 1', Artisan::output()); }
public function testNotFoundFilter() { $this->initDB(); $exitCode = Artisan::call('contact:list', ['--filter' => 'xxx']); $this->assertEquals($exitCode, 0); $this->assertContains('No contact found for given filter.', Artisan::output()); }
public function makeMigration($name) { $name = $this->migrationName($name); if (!class_exists($name)) { Artisan::call('make:migration', ['name' => $name, '--create' => upperToUnderscore($name)]); } }
/** * Run the seed command for the given module * @param SeedModuleRequest $request * @return mixed */ public function seed(SeedModuleRequest $request) { $output = new BufferedOutput(); Artisan::call('module:seed', ['module' => $request->module], $output); Flash::message($output->fetch()); return Redirect::route('admin.workshop.workbench.index'); }
/** * Execute the console command. * * @return mixed */ public function handle() { $region = $this->argument('regionName'); $this->mswSpotService->getSpotsInRegion($region)->each(function ($spot) { Artisan::call('msw:import-forecast', ['spotId' => $spot->id]); }); }
/** @test */ public function can_publish() { $this->setAnnotationsPath(); Artisan::call('l5-swagger:publish'); $this->assertTrue(file_exists(config_path('l5-swagger.php'))); $this->assertTrue(file_exists(config('l5-swagger.paths.views') . '/index.blade.php')); }
public function close() { //filesystem $this->files = new Filesystem(); //php artisan migrate:rollback $cmd = 'php artisan migrate:rollback'; exec($cmd, $output); //php artisan delete:relation OrangeType Orange Artisan::call('delete:relation', (array) ['model_A' => 'OrangeType', 'model_B' => 'Orange']); //php artisan delete:scaffold OrangeType Artisan::call('delete:scaffold', (array) ['name' => 'OrangeType']); //php artisan delete:scaffold Orange Artisan::call('delete:scaffold', (array) ['name' => 'Orange']); //delete migration files $this->deleteMigration($models = ['orange_types', 'oranges']); //delete public/dog-ears/ $this->files->deleteDirectory('./public/dog-ears'); //delete common view files if ($this->files->exists('./resources/views/error.blade.php')) { $this->files->delete('./resources/views/error.blade.php'); } if ($this->files->exists('./resources/views/layout.blade.php')) { $this->files->delete('./resources/views/layout.blade.php'); } if ($this->files->exists('./resources/views/navi.blade.php')) { $this->files->delete('./resources/views/navi.blade.php'); } }
/** * Execute the console command. * * @return mixed */ public function handle() { $namespace = $this->getAppNamespace(); $this->shouldBackup = 'n' === strtolower($this->askWithCompletion('Do you want to overwrite files when copying? (Saying \'no\' will create time-stamped copies of the originals.)', ['y', 'n'])); $this->copyJumpstartAsset(__DIR__ . '/../../assets/views/app.blade.php', base_path('resources/views/app.blade.php')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/views/home.blade.php', base_path('resources/views/home.blade.php')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/views/welcome.blade.php', base_path('resources/views/welcome.blade.php')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/views/auth/login.blade.php', base_path('resources/views/auth/login.blade.php')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/views/auth/password.blade.php', base_path('resources/views/auth/password.blade.php')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/views/auth/register.blade.php', base_path('resources/views/auth/register.blade.php')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/views/auth/reset.blade.php', base_path('resources/views/auth/reset.blade.php')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/css/bootstrap-3.3.5.css.map', public_path('css/bootstrap-3.3.5.css.map')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/css/bootstrap-3.3.5.min.css', public_path('css/bootstrap-3.3.5.min.css')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/css/bootstrap-theme.css.map', public_path('css/bootstrap-theme.css.map')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/css/bootstrap-theme.min.css', public_path('css/bootstrap-theme.min.css')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/js/bootstrap-3.3.5.min.js', public_path('js/bootstrap-3.3.5.min.js')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/js/jquery-2.1.4.min.js', public_path('js/jquery-2.1.4.min.js')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/js/jquery-2.1.4.min.map', public_path('js/jquery-2.1.4.min.map')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/fonts/glyphicons-halflings-regular.eot', public_path('fonts/glyphicons-halflings-regular.eot')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/fonts/glyphicons-halflings-regular.svg', public_path('fonts/glyphicons-halflings-regular.svg')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/fonts/glyphicons-halflings-regular.ttf', public_path('fonts/glyphicons-halflings-regular.ttf')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/fonts/glyphicons-halflings-regular.woff', public_path('fonts/glyphicons-halflings-regular.woff')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/fonts/glyphicons-halflings-regular.woff2', public_path('fonts/glyphicons-halflings-regular.woff2')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/routes.php', app_path('Http/routes.php')); $this->copyJumpstartAsset(__DIR__ . '/../../assets/Controllers/HomeController.php', base_path('app/Http/Controllers/HomeController.php'), $namespace); $this->copyJumpstartAsset(__DIR__ . '/../../assets/Controllers/WelcomeController.php', base_path('app/Http/Controllers/WelcomeController.php'), $namespace); $this->copyJumpstartMigrationAsset(__DIR__ . '/../../assets/database/migrations/_add_name_fields_to_users_table_jumpstart.php', base_path('database/migrations/' . Carbon::now()->format('Y_m_d_His') . '_add_name_fields_to_users_table_jumpstart.php')); $this->copyJumpstartMigrationAsset(__DIR__ . '/../../assets/database/migrations/_add_softdeletes_to_users_table_jumpstart.php', base_path('database/migrations/' . Carbon::now()->format('Y_m_d_His') . '_add_softdeletes_to_users_table_jumpstart.php')); if ('y' === strtolower($this->ask('Do you want to run the migrations?', 'y'))) { Artisan::call('migrate'); } }
public function testNetBlockListCommandWithValidFilter() { $exitCode = Artisan::call('netblock:list', ["--filter" => "10.1.16.128"]); $this->assertEquals($exitCode, 0); $this->assertContains("Customer 6", Artisan::output()); $this->assertNotContains("Global internet", Artisan::output()); }
public function testWithValidFilter() { $this->initDB(); $exitCode = Artisan::call('user:show', ['user' => $this->user->id]); $this->assertEquals($exitCode, 0); $this->assertContains($this->user->first_name, Artisan::output()); }
/** * before each test runs * here we migrate if no migration and reset if migration already run * TODO: This is not working when Laravel5 transaction mode (cleanup=true in config) is activated, figure out why (eg error: no such table: users in routing/RegisterCest) * * @param TestEvent $e * @return bool */ public function beforeTest(TestEvent $e) { // instantiate Codeception console output $output = new Output([]); // get laravel5 module $l5 = $this->getModule('Laravel5'); // output error and die if transaction mode is active (this extension does not work with Laravel 5 transaction mode) TODO: figure out why if ($l5->config['cleanup']) { $output->writeln("\n[41m" . "Please set Laravel5 Codeception module's cleanup to false (in tests/functional.suite.yml) before using NeilRussell6\\CodeceptionLaravel5Extensions\\ArtisanMigrateExtension." . "[0m"); die; } // get current migration status Artisan::call('migrate:status', ['--database' => $this->connection]); $status = Artisan::output(); //var_dump($status); // ... if no migrations the run migrate if (str_contains($status, "No migrations found")) { Artisan::call('migrate', ['--database' => $this->connection]); //$result = Artisan::output(); //var_dump($result); } else { Artisan::call('migrate:refresh', ['--database' => $this->connection]); //$result = Artisan::output(); //var_dump($result); } }
public function publishAssets(Theme $theme) { try { Artisan::call('stylist:publish', ['theme' => $theme->getName()]); } catch (InvalidArgumentException $e) { } }
/** @test */ public function optimized_class_is_created_in_production_environment() { $this->assertFileNotExists(base_path('bootstrap/cache/compiled.php')); Config::set('app.debug', false); Artisan::call('azure:optimize-classes'); $this->assertFileExists(base_path('bootstrap/cache/compiled.php')); }
/** * Execute the console command. * * @return mixed * @throws \Gitonomy\Git\Exception\RuntimeException * @throws \Gitonomy\Git\Exception\InvalidArgumentException */ public function handle() { $inspector = new Inspector($this->settings); $repository = $inspector->getRepositoryByUrl($this->argument('repositoryUrl')); $inspectedRepository = $inspector->inspectRepository($repository); $header = array_keys((array) $inspectedRepository[key($inspectedRepository)]); if (!$this->option('dry-run')) { $remote = $inspectedRepository['remote']; \Swis\GotLaravel\Models\Results::unguard(); foreach ($inspectedRepository['results'] as $result) { $insert = $result->toArray(); $insert['remote'] = $remote; $insert['author_slug'] = Str::slug($result->getAuthor()); $insert['created_at'] = Carbon::createFromTimestamp($insert['date']); try { \Swis\GotLaravel\Models\Results::updateOrCreate(array_only($insert, ['remote', 'filename', 'line']), $insert); } catch (\Exception $e) { $this->error('Couldnt insert: ' . $e->getMessage() . PHP_EOL . print_r($insert, 1)); } } } reset($inspectedRepository['results']); array_walk($inspectedRepository['results'], function (&$row) { $row = $row->toArray(); }); $this->info($inspectedRepository['remote']); $this->table($header, $inspectedRepository['results']); Artisan::call('got:normalize-names'); }
/** * Execute the console command. * * @return mixed */ public function fire() { // Check not 'sync' if (Config::get('queue.default') == "sync") { Artisan::call('down'); $this->info("Application maintenance mode enabled."); return; } // Push job onto queue Queue::push(function ($job) { // Take Application down. Artisan::call('down'); // Add Log message Log::info("Application is down, pausing queue while maintenance happens."); // Loop, waiting for app to come back up while (App::isDownForMaintenance()) { echo "."; sleep(5); } // App is back online, kill worker to restart daemon. Log::info("Application is up, rebooting queue."); Artisan::call('queue:restart'); $job->delete(); }); // Wait until Maintenance Mode enabled. while (!App::isDownForMaintenance()) { sleep(1); } $this->info("Application maintenance mode enabled."); }
public function publishAssets(Module $module) { try { Artisan::call('module:publish', ['module' => $module->getName()]); } catch (InvalidArgumentException $e) { } }
public function handle() { $generator = (require resource_path('crud/generator.php')); foreach ($generator as $name => $config) { Artisan::call('crud:generate', $this->buildOptions($name, $config)); } }
/** * Define the application's command schedule. * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) { $schedule->command('proxy:check')->twiceDaily(); $schedule->command('proxy:fetch')->twiceDaily()->after(function () { Artisan::call('proxy:security'); }); }
/** * Execute the console command. * * @return mixed */ public function handle() { $users = User::all(); foreach ($users as $user) { Artisan::call('api-key:generate', ['--user-id' => $user->id]); } }
/** @test */ public function it_throws_an_exception_for_invalid_configuration() { $this->app['config']->set('server-monitor.monitors.InvalidMonitor', [['alarmPercentage' => 75]]); $this->setExpectedException(InvalidConfiguration::class); $resultCode = Artisan::call('monitor:run'); $this->assertNotEquals(0, $resultCode); }
public function refresh($action) { switch ($action) { case "application": Artisan::call('cache:clear'); Flash::success('Limpeza do cache da aplicação concluído.'); break; case "images": Artisan::call('image:clear'); Flash::success('Limpeza do cache das imagens concluído.'); break; case "views": Artisan::call('responsecache:clear'); Artisan::call('view:clear'); Flash::success('Limpeza do cache das views concluído.'); break; case "routes": Artisan::call('route:clear'); Flash::success('Limpeza do cache das rotas concluído.'); break; case "clear-compiled": Artisan::call('clear-compiled'); Flash::success('Limpeza do cache de otimização concluído.'); break; case "routes-cache": Artisan::call('route:cache'); Flash::success('Cache de rotas gerado com sucesso.'); break; case "optimize": Artisan::call('optimize', ['--force' => true]); Flash::success('Cache de otimização gerado com sucesso.'); break; } return ($url = session()->get('backUrl')) ? redirect($url) : redirect()->route('admin.mcache.index'); }
public function setUp() { parent::setUp(); Artisan::call('migrate'); Artisan::call('db:seed'); $this->client = new GuzzleHttp\Client(['base_uri' => 'http://*****:*****@gmail.com', 'secret']]); }
public function setUp() { parent::setUp(); Artisan::call('migrate'); Artisan::call('db:seed'); $this->user = User::find(1); $this->user->logins = [$this->user->email, 'password']; }
/** * Run the migrations. * * @return void */ public function up() { Schema::table('track_files', function (Blueprint $table) { $table->integer('filesize')->nullable()->unsigned(); }); // Populate file sizes Artisan::call('rebuild:filesizes', ['--force' => true]); }
public function trigger() { if (strtolower(Input::get('repository.full_name')) === strtolower(config('wikiclone.repository'))) { Artisan::call('wiki:update'); } else { return response('Unauthorized action. (wrong repository)', 401); } }
public function testNetBlockListCommandWithValidFilter() { $exitCode = Artisan::call('user:list', ['--filter' => 'user']); $this->assertEquals($exitCode, 0); $output = Artisan::output(); $this->assertContains('*****@*****.**', $output); $this->assertNotContains('*****@*****.**', $output); }
/** * A basic installation action defined for setting up database tables * for your package * * @author Neelkanth Kaushik * @version 1.0.0 */ public function install() { \Illuminate\Support\Facades\Artisan::call('migrate', array('--path' => '/vendor/packagename/application/src/database/migrations/')); echo "<h2>Package Tables Created Succesfully.</h2>"; \Illuminate\Support\Facades\Artisan::call('db:seed', ['--class' => 'Package\\Application\\database\\seeds\\PackageTableSeeder']); echo "<br/>"; echo "<h2>Package Tables Seeded Successfully.</h2>"; }
public function testNetBlockShowWithStartEndFilter() { $this->initDB(); $ip = $this->netblock->last_ip; $exitCode = Artisan::call('netblock:show', ['netblock' => $ip]); $this->assertEquals($exitCode, 0); $this->assertContains($this->netblock->contact->name, Artisan::output()); }
public function testFilter() { $exitCode = Artisan::call('collector:list', ['--filter' => 'Rbl']); $this->assertEquals($exitCode, 0); $output = Artisan::output(); $this->assertContains('Rbl', $output); $this->assertNotContains('Snds', $output); }