function let() { $kernel = new Kernel(); $kernel->boot(true); $user = UserModel::find(1); // tokens are usually contructed using the // generate factory. $this->beConstructedThrough('generate', [$user, 'test']); }
/** * Initalize the slim application * * @param testing whether to load * testing configuration. **/ public function boot($testing = false) { $app = new Slim(); self::loadRoutes($app); self::loadConfiguration($app, Kernel::getProjectRoot() . '/config.json'); if ($testing) { self::loadConfiguration($app, Kernel::getProjectRoot() . '/config.testing.json'); } DB::connectMySQL($app->config('db.database'), $app->config('db.user'), $app->config('db.password')); $this->app = $app; }
<?php require "vendor/autoload.php"; use Kagia\EmojiApp\Kernel; $kernel = new Kernel(); $kernel->boot(); $kernel->loadSQL(__DIR__ . '/../sql/fixtures.sql');
<?php require 'vendor/autoload.php'; use Kagia\EmojiApp\Kernel; $kernel = new Kernel(); $kernel->boot(); $kernel->serve(); $kernel->shutdown();
<?php require "vendor/autoload.php"; use Kagia\EmojiApp\Kernel; use Kagia\EmojiApi\Models\UserModel; $kernel = new Kernel(); $kernel->boot(); if (count($argv) == 3) { $username = $argv[1]; $password = $argv[2]; $user = new UserModel(); $user->username = $username; $user->password = $password; $user->save(); echo "user {$username} created!\n"; } else { echo "usage: create-user <username> <mypassword>\n"; }
<?php require "vendor/autoload.php"; use Kagia\EmojiApp\Kernel; $kernel = new Kernel(); $kernel->boot(true); $kernel->loadSQL(__DIR__ . '/../sql/schema.sql');