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;
 }
Ejemplo n.º 4
0
 /**
  * Teardown method.
  **/
 public function teardown()
 {
     $this->rollback();
     $this->repo = null;
     $this->service = null;
     parent::teardown();
 }
Ejemplo n.º 5
0
 public function setUp()
 {
     parent::setUp();
     DatabaseSeeder::$withMedia = false;
     $this->artisan('migrate');
     $this->artisan('db:seed', ['--class' => 'ArticleSeeder']);
 }
Ejemplo n.º 6
0
 public function tearDown()
 {
     if ($container = Mockery::getContainer()) {
         $this->addToAssertionCount($container->mockery_getExpectationCount());
     }
     parent::tearDown();
 }
Ejemplo n.º 7
0
 public function setUp()
 {
     parent::setUp();
     $this->app['config']->set('database.default', 'sqlite');
     $this->app['config']->set('database.connections.sqlite.database', ':memory:');
     $this->migrate();
 }
Ejemplo n.º 8
0
 public function setUp()
 {
     parent::setUp();
     $this->artisan('db:seed');
     $this->organization = new Organization();
     $this->faker = Factory::create();
 }
Ejemplo n.º 9
0
 /**
  * Prepare test environment.
  *
  * @see \Illuminate\Foundation\Testing\TestCase::setUp()
  */
 public function setUp()
 {
     parent::setUp();
     foreach ($this->seedDependency[$this->getName()] as $seeder) {
         $this->seed($seeder);
     }
 }
Ejemplo n.º 10
0
 public function tearDown()
 {
     // Uninstall Dashboard
     $this->artisan('dashboard:uninstall');
     // Run parent class tear down method.
     parent::tearDown();
 }
Ejemplo n.º 11
0
 /**
  * Set up the test environment.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->afterApplicationCreated(function () {
         $this->artisan('db:seed');
     });
 }
Ejemplo n.º 12
0
 public function setUp()
 {
     parent::setUp();
     \Config::set('database.default', 'sqlite');
     \Config::set('database.connections', ['sqlite' => array('driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '')]);
     $this->createDatabase();
 }
Ejemplo n.º 13
0
 public function tearDown()
 {
     $this->beforeApplicationDestroyed(function () {
         DB::disconnect();
     });
     parent::tearDown();
 }
Ejemplo n.º 14
0
 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);
 }
Ejemplo n.º 16
0
 /**
  * @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);
 }
Ejemplo n.º 17
0
 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';
 }
Ejemplo n.º 18
0
 /**
  * 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();
 }
Ejemplo n.º 19
0
 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]);
 }
Ejemplo n.º 21
0
 public function tearDown()
 {
     parent::tearDown();
     $this->refreshApplication();
     Storage::deleteDirectory('testing/ahk');
     Storage::deleteDirectory('testing/cms');
     Storage::deleteDirectory('testing/img');
 }
Ejemplo n.º 22
0
 /**
  * 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);
 }
Ejemplo n.º 23
0
 /**
  * @return void
  */
 public function tearDown()
 {
     DB::disconnect();
     m::close();
     $this->tearDownModels();
     $this->app->reset();
     $this->app = null;
     parent::tearDown();
 }
Ejemplo n.º 24
0
 /**
  * @return void
  */
 public function tearDown()
 {
     if (!self::$migrationFailed) {
         DB::disconnect();
         m::close();
         $this->tearDownModels();
         $this->app->reset();
         $this->app = null;
     }
     parent::tearDown();
 }
Ejemplo n.º 25
0
 /**
  * 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();
 }
Ejemplo n.º 26
0
 /**
  * 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');
 }
Ejemplo n.º 27
0
 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();
 }
Ejemplo n.º 28
0
 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();
 }
Ejemplo n.º 29
0
 /**
  * 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();
 }
Ejemplo n.º 30
0
 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');
     });
 }