public static function tearDownAfterClass() { if (!self::$timing) { echo "\n"; return; } $class = get_called_class(); echo "Timing results : {$class}\n"; $s = sprintf("%40s %6s %9s %9s %4s\n", 'name', 'count', 'total', 'avg', '% best'); echo str_repeat('=', strlen($s)) . "\n"; echo $s; echo str_repeat('-', strlen($s)) . "\n"; array_walk(self::$timing, function (&$value, $key) { $value['avg'] = round($value['total'] / $value['count'] * 1000000, 3); }); usort(self::$timing, function ($a, $b) { $at = $a['avg']; $bt = $b['avg']; return $at === $bt ? 0 : ($at < $bt ? -1 : 1); }); $best = self::$timing[0]['avg']; foreach (self::$timing as $timing) { printf("%40s %6d %7.3fms %7.3fus %4.1f%%\n", $timing['name'], $timing['count'], round($timing['total'] * 1000, 3), $timing['avg'], round($timing['avg'] / $best * 100, 3)); } echo str_repeat('-', strlen($s)) . "\n\n"; printf("\nTiming compensated for avg overhead for: timeIt of %.3fus and startTimer/endTimer of %.3fus per invocation\n\n", self::$timeItOverhead * 1000000, self::$startEndOverhead * 1000000); parent::tearDownAfterClass(); }
public function test(TestCase $test, Generator $faker) { $value = $faker->randomElement(array_filter(array_keys($this->items)), function ($value) { return !!$value; }); return $test->select($value, $this->name); }
public function test(TestCase $test, Generator $faker) { $values = array_filter(array_keys($this->items), function ($value) { return !!$value; }); if (count($values)) { $test->select($faker->randomElements($values), "{$this->name}"); } return true; }
/** * Teardown method. **/ public function teardown() { $this->rollback(); $this->repo = null; $this->service = null; parent::teardown(); }
public function setUp() { parent::setUp(); DatabaseSeeder::$withMedia = false; $this->artisan('migrate'); $this->artisan('db:seed', ['--class' => 'ArticleSeeder']); }
public function tearDown() { if ($container = Mockery::getContainer()) { $this->addToAssertionCount($container->mockery_getExpectationCount()); } parent::tearDown(); }
public function setUp() { parent::setUp(); $this->app['config']->set('database.default', 'sqlite'); $this->app['config']->set('database.connections.sqlite.database', ':memory:'); $this->migrate(); }
public function setUp() { parent::setUp(); $this->artisan('db:seed'); $this->organization = new Organization(); $this->faker = Factory::create(); }
/** * Prepare test environment. * * @see \Illuminate\Foundation\Testing\TestCase::setUp() */ public function setUp() { parent::setUp(); foreach ($this->seedDependency[$this->getName()] as $seeder) { $this->seed($seeder); } }
public function tearDown() { // Uninstall Dashboard $this->artisan('dashboard:uninstall'); // Run parent class tear down method. parent::tearDown(); }
/** * Set up the test environment. */ protected function setUp() { parent::setUp(); $this->afterApplicationCreated(function () { $this->artisan('db:seed'); }); }
public function setUp() { parent::setUp(); \Config::set('database.default', 'sqlite'); \Config::set('database.connections', ['sqlite' => array('driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '')]); $this->createDatabase(); }
public function tearDown() { $this->beforeApplicationDestroyed(function () { DB::disconnect(); }); parent::tearDown(); }
public function teardown() { parent::teardown(); if ($this->useDatabase) { $this->teardownDb(); } }
function assertResponseStatus($code) { parent::assertResponseStatus($code); $this->assertEquals($code, $this->client->getResponse()->getData()->meta->code); $this->assertNotNull($this->client->getResponse()->getData()->meta->error_type); $this->assertNotNull($this->client->getResponse()->getData()->meta->error_message); }
/** * @param string $method * @param string $uri * @param array $parameters * @param array $cookies * @param array $file * @param array $server * @param null $content * * @return \Illuminate\Http\Response */ public function call($method, $uri, $parameters = [], $cookies = [], $file = [], $server = [], $content = null) { if (empty($server)) { $server = ['HTTP_Authorization' => 'Bearer ' . $this->token]; } return parent::call($method, $uri, $parameters, $cookies, $file, $server, $content); }
public function setUp() { \Illuminate\Foundation\Testing\TestCase::setUp(); $path = realpath(__DIR__ . '/migrations'); $path = substr($path, strlen(getcwd()) + 1); \Artisan::call('migrate', array('--path' => $path)); include_once dirname(__FILE__) . '/TestModel.php'; }
/** * Setup DB and test variables before each test. */ protected function setUp() { parent::setUp(); $this->app['config']->set('database.default', 'sqlite'); $this->app['config']->set('database.connections.sqlite.database', ':memory:'); $this->migrate(); $this->user = $this->makeUser(); }
public function setUp() { parent::setUp(); $this->prepareForTests(); $this->userId = 1; // Clear response $this->httpResponse = new \Illuminate\Http\Response(); }
/** * Setup the test environment. * * @return void */ protected function setUp() { parent::setUp(); // Unbind model before each test. app('sahib_form')->model(null); // Remove errors before each test. $this->session(['errors' => null]); }
public function tearDown() { parent::tearDown(); $this->refreshApplication(); Storage::deleteDirectory('testing/ahk'); Storage::deleteDirectory('testing/cms'); Storage::deleteDirectory('testing/img'); }
/** * Sets up prerequisites. */ public function setUp() { parent::setUp(); $websiteRepositoryMock = Mockery::mock(WebsiteRepositoryContract::class); $website = factory(Website::class)->make(); $websiteRepositoryMock->shouldReceive('findById')->with(1)->andReturn($website); $this->app->instance(WebsiteRepositoryContract::class, $websiteRepositoryMock); }
/** * @return void */ public function tearDown() { DB::disconnect(); m::close(); $this->tearDownModels(); $this->app->reset(); $this->app = null; parent::tearDown(); }
/** * @return void */ public function tearDown() { if (!self::$migrationFailed) { DB::disconnect(); m::close(); $this->tearDownModels(); $this->app->reset(); $this->app = null; } parent::tearDown(); }
/** * Setup DB before each test. */ public function setUp() { parent::setUp(); $this->app['config']->set('database.default', 'sqlite'); $this->app['config']->set('database.connections.sqlite.database', ':memory:'); $this->app['config']->set('app.url', 'http://localhost/'); $this->app['config']->set('app.debug', false); $this->app['config']->set('app.key', env('APP_KEY', '1234567890123456')); $this->app['config']->set('app.cipher', 'AES-128-CBC'); $this->app->boot(); $this->migrate(); }
/** * Runs before every test. */ public function setUp() { parent::setUp(); Model::unguard(false); if (false === static::$staged) { $this->stage(); static::$staged = true; } $this->setService(); $config = $this->app->make('Config'); static::$wrapper = $config::get('df.resources_wrapper'); }
public function setUp() { parent::setUp(); // C locale means that no translations will be done. $this->app->setLocale('C'); // Reset clock stuff. We pick a timezone at random and reset (and freeze) // Carbon::now() to current time. $timezones = array('Antarctica/South_Pole', 'Arctic/Longyearbyen', 'Australia/Tasmania', 'Pacific/Pohnpei'); date_default_timezone_set($timezones[array_rand($timezones)]); Carbon::setTestNow(null); Carbon::setTestNow(Carbon::now()); $this->setUp_doctrine(); }
public function tearDown() { $col = 'Tables_in_' . getenv('DB_DATABASE'); DB::statement("SET FOREIGN_KEY_CHECKS=0"); foreach (DB::select("SHOW TABLES") as $table) { $tableName = $table->{$col}; DB::statement("DROP TABLE IF EXISTS `{$tableName}`"); //DB::statement("TRUNCATE `$tableName`"); } DB::statement("SET FOREIGN_KEY_CHECKS=1"); //DB::rollBack(); parent::tearDown(); }
/** * Delete everything out of our testing database. */ public static function tearDownAfterClass() { parent::tearDownAfterClass(); \Definition::truncate(); \CsvDefinition::truncate(); \InstalledDefinition::truncate(); \JsonDefinition::truncate(); \ShpDefinition::truncate(); \SparqlDefinition::truncate(); \XlsDefinition::truncate(); \XmlDefinition::truncate(); \GeoProperty::truncate(); \TabularColumns::truncate(); \Geoprojection::truncate(); }
public function setUp() { parent::setUp(); Schema::dropIfExists('articles'); Schema::create('articles', function (Illuminate\Database\Schema\Blueprint $table) { $table->increments('id'); $table->string('body'); }); Schema::dropIfExists('users'); Schema::create('users', function (\Illuminate\Database\Schema\Blueprint $table) { $table->increments('id'); $table->string('username'); }); Schema::dropIfExists('groups'); Schema::create('groups', function (\Illuminate\Database\Schema\Blueprint $table) { $table->increments('id'); $table->string('name'); $table->boolean('is_admin')->default(false); }); Schema::dropIfExists('group_user'); Schema::create('group_user', function (\Illuminate\Database\Schema\Blueprint $table) { $table->integer('group_id'); $table->integer('user_id'); }); Schema::dropIfExists('permissions'); Schema::create('permissions', function (\Illuminate\Database\Schema\Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('object_type'); $table->string('codename'); }); Schema::dropIfExists('group_object_permission'); Schema::create('group_object_permission', function (\Illuminate\Database\Schema\Blueprint $table) { $table->increments('id'); $table->integer('group_id'); $table->string('object_type'); $table->integer('object_id'); $table->integer('permission_id'); }); Schema::dropIfExists('user_object_permission'); Schema::create('user_object_permission', function (\Illuminate\Database\Schema\Blueprint $table) { $table->increments('id'); $table->integer('user_id'); $table->string('object_type'); $table->integer('object_id'); $table->integer('permission_id'); }); }