protected function setUp() { parent::setUp(); $this->container = new ContainerBuilder(); $this->container->register('service_container', 'Symfony\\Component\\DependencyInjection\\ContainerBuilder')->setSynthetic(TRUE); $this->container->set('service_container', $this->container); $this->container->register('settings', 'Drupal\\Core\\Site\\Settings')->setFactoryClass('Drupal\\Core\\Site\\Settings')->setFactoryMethod('getInstance'); $this->container->register('keyvalue', 'Drupal\\Core\\KeyValueStore\\KeyValueFactory')->addArgument(new Reference('service_container'))->addArgument(new Reference('settings')); $this->container->register('keyvalue.expirable', 'Drupal\\Core\\KeyValueStore\\KeyValueExpirableFactory')->addArgument(new Reference('service_container'))->addArgument(new Reference('settings')); // Define two data collections, $this->collections = array(0 => 'zero', 1 => 'one'); // Create several objects for testing. for ($i = 0; $i <= 5; $i++) { $this->objects[$i] = $this->randomObject(); } }
function setUp() { parent::setUp(); $this->key = 'default'; $this->originalTarget = 'default'; $this->target = 'DatabaseConnectionUnitTest'; // Determine whether the database driver is MySQL. If it is not, the test // methods will not be executed. // @todo Make this test driver-agnostic, or find a proper way to skip it. // @see http://drupal.org/node/1273478 $connection_info = Database::getConnectionInfo('default'); $this->skipTest = (bool) ($connection_info['default']['driver'] != 'mysql'); if ($this->skipTest) { // Insert an assertion to prevent Simpletest from interpreting the test // as failure. $this->pass('This test is only compatible with MySQL.'); } // Create an additional connection to monitor the connections being opened // and closed in this test. // @see TestBase::changeDatabasePrefix() Database::addConnectionInfo('default', 'monitor', $connection_info['default']); $this->monitor = Database::getConnection('monitor'); }
protected function tearDown() { db_drop_table('key_value_expire'); db_drop_table('semaphore'); parent::tearDown(); }
public function tearDown() { $this->fixtures->dropTables(Database::getConnection()); parent::tearDown(); }
function setUp() { parent::setUp(); }
/** * {@inheritdoc} */ protected function tearDown() { if ($this->kernel instanceof DrupalKernel) { $this->kernel->shutdown(); } // Before tearing down the test environment, ensure that no stream wrapper // of this test leaks into the parent environment. Unlike all other global // state variables in Drupal, stream wrappers are a global state construct // of PHP core, which has to be maintained manually. // @todo Move StreamWrapper management into DrupalKernel. // @see https://drupal.org/node/2028109 foreach ($this->streamWrappers as $scheme => $type) { $this->unregisterStreamWrapper($scheme, $type); } parent::tearDown(); }