本文整理汇总了PHP中Orchestra\Testbench\TestCase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP TestCase::setUp方法的具体用法?PHP TestCase::setUp怎么用?PHP TestCase::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Orchestra\Testbench\TestCase
的用法示例。
在下文中一共展示了TestCase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
parent::setUp();
$artisan = $this->app->make('artisan');
$artisan->call('migrate', ['--database' => 'testbench', '--path' => '../tests/migrations']);
$this->countQueries();
}
示例2: setUp
public function setUp()
{
parent::setUp();
\Config::set('database.default', 'sqlite');
\Config::set('database.connections', ['sqlite' => array('driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '')]);
$this->createDatabase();
}
示例3: setUp
/**
* Setup the test environment.
*/
public function setUp()
{
parent::setUp();
// uncomment to enable route filters if your package defines routes with filters
// $this->app['router']->enableFilters();
// create an artisan object for calling migrations
//$artisan = $this->app->make('artisan');
// call migrations for packages upon which our package depends, e.g. Cartalyst/Sentry
// not necessary if your package doesn't depend on another package that requires
// running migrations for proper installation
/* uncomment as necessary
$artisan->call('migrate', [
'--database' => 'testbench',
'--path' => '../vendor/cartalyst/sentry/src/migrations',
]);
*/
// call migrations that will be part of your package, assumes your migrations are in src/migrations
// not neccessary if your package doesn't require any migrations to be run for
// proper installation
/* uncomment as neccesary
$artisan->call('migrate', [
'--database' => 'testbench',
'--path' => 'migrations',
]);
*/
// call migrations specific to our tests, e.g. to seed the db
/*$artisan->call('migrate', array(
'--database' => 'testbench',
'--path' => '../tests/migrations',
));*/
}
示例4: setUp
public function setUp()
{
parent::setUp();
$this->app->instance('path.public', __DIR__ . '/fixture');
Image::deleteManipulated($this->imagePath);
$this->imageSize = getimagesize(public_path() . $this->imagePath);
}
示例5: setUp
public function setUp()
{
parent::setUp();
$this->artisan('migrate', ['--database' => 'testbench', '--realpath' => realpath(__DIR__ . '/database')]);
// @TODO refactor fixtures, this schema sucks so much :(
\DB::table('person')->delete();
\DB::table('son')->delete();
\DB::table('roles')->delete();
\DB::table('person')->insert(['id' => 1, 'name' => 'Homer']);
\DB::table('person')->insert(['id' => 2, 'name' => 'Marge']);
\DB::table('person')->insert(['id' => 3, 'name' => 'Apu']);
\DB::table('son')->insert(['pid' => 1, 'name' => 'Bart']);
\DB::table('son')->insert(['pid' => 1, 'name' => 'Lisa']);
\DB::table('son')->insert(['pid' => 1, 'name' => 'Maggie']);
\DB::table('son')->insert(['pid' => 2, 'name' => 'Lisa']);
\DB::table('roles')->insert(['id' => 1, 'name' => 'Father']);
\DB::table('roles')->insert(['id' => 2, 'name' => 'Mother']);
\DB::table('roles')->insert(['id' => 3, 'name' => 'Vendor']);
\DB::table('roles')->insert(['id' => 4, 'name' => 'Children']);
\DB::table('roles')->insert(['id' => 5, 'name' => 'Nuclear Safety Inspector']);
\DB::table('roles')->insert(['id' => 6, 'name' => 'Ambulance Driver']);
\DB::table('roles')->insert(['id' => 7, 'name' => 'Food Critic']);
\DB::table('person_roles')->insert(['pid' => 1, 'rid' => 1]);
\DB::table('person_roles')->insert(['pid' => 2, 'rid' => 2]);
\DB::table('person_roles')->insert(['pid' => 3, 'rid' => 3]);
}
示例6: setUp
public function setUp()
{
parent::setUp();
$this->queries = new Helpers\SqliteQueries();
$this->migrateDatabase();
$this->seedDatabase();
}
示例7: setUp
public function setUp()
{
parent::setUp();
if (File::isDirectory('packages')) {
File::deleteDirectory('packages');
}
}
示例8: setUp
public function setUp()
{
parent::setUp();
if (!file_exists($this->testImage)) {
copy($this->sample, $this->testImage);
}
}
示例9: setUp
public function setUp()
{
parent::setUp();
Route::any('{anything}', function () {
})->where('anything', '.*');
$this->app['router']->enableFilters();
}
示例10: setUp
public function setUp()
{
parent::setUp();
$this->app->bindShared('path.base', function () {
return BASE_PATH;
});
}
示例11: setUp
public function setUp()
{
parent::setUp();
app('Illuminate\\Database\\DatabaseManager')->beginTransaction();
$this->artisan = $this->app->make('Illuminate\\Contracts\\Console\\Kernel');
$this->artisan->call('migrate', ['--realpath' => realpath(__DIR__ . '/../resources/migrations')]);
}
示例12: setUp
public function setUp()
{
parent::setUp();
$this->app['path.database'] = __DIR__;
$migration = new CreateTokensTable();
$migration->up();
Schema::create('users', function (\Illuminate\Database\Schema\Blueprint $table) {
$table->increments('id');
$table->string('username', 128)->unique();
$table->timestamps();
});
$user = new User();
$user->username = 'jerry';
$user->save();
$user = new User();
$user->username = 'khan';
$user->save();
$token = App::make('token');
$token->create(1, 1, 7200);
// 1 OK
$token->create(2, 1, 7200);
// 2 Not loggable by token
$token->create(1, false, 7200);
// 3 Expired
$obj = $token->find(3);
$obj->expire_at = time() - 3600;
$token->persist($obj);
$token->create();
// 4 token without user
}
示例13: setUp
/**
* Setup test.
*
* @return void
*/
public function setUp()
{
parent::setUp();
$this->dilemma = $this->app->make('TradeoffDilemma', $this->getResolution());
$this->resolution = $this->dilemma->getResolution();
$this->map = $this->resolution->getMap();
}
示例14: setUp
public function setUp()
{
parent::setUp();
$this->bookRepo = m::mock('Bakgat\\Notos\\Domain\\Model\\Resource\\BookRepository');
$this->org = Organization::register(new Name('VBS De Klimtoren'), new DomainName('klimtoren.be'));
$this->spec = new IsbnIsUnique($this->bookRepo);
}
示例15: setUp
/**
* Setup the test environment.
*
* @return void
*/
public function setUp()
{
parent::setUp();
$this->model = Mockery::mock(Model::class)->makePartial();
$this->repository = Mockery::mock(Repository::class)->makePartial();
$this->repository->setupRepository($this->model);
}