Sets up Drupal unit test environment.
Overrides DrupalUnitTestBase::setUp
DrupalUnitTestBase::$modules
protected function setUp() {
parent::setUp();
$this->entities = array();
$this
->enableModules(array(
'entity',
), TRUE);
$this->factory = $this->container
->get('entity.query');
// These two are here to make sure that matchArray needs to go over several
// non-matches on every levels.
$array['level1']['level2a'] = 9;
$array['level1a']['level2'] = 9;
// The tests match array.level1.level2.
$array['level1']['level2'] = 1;
$entity = entity_create('config_query_test', array(
'label' => $this
->randomName(),
'id' => '1',
'number' => 31,
'array' => $array,
));
$this->entities[] = $entity;
$entity
->enforceIsNew();
$entity
->save();
$array['level1']['level2'] = 2;
$entity = entity_create('config_query_test', array(
'label' => $this
->randomName(),
'id' => '2',
'number' => 41,
'array' => $array,
));
$this->entities[] = $entity;
$entity
->enforceIsNew();
$entity
->save();
$array['level1']['level2'] = 1;
$entity = entity_create('config_query_test', array(
'label' => 'test_prefix_' . $this
->randomName(),
'id' => '3',
'number' => 59,
'array' => $array,
));
$this->entities[] = $entity;
$entity
->enforceIsNew();
$entity
->save();
$array['level1']['level2'] = 2;
$entity = entity_create('config_query_test', array(
'label' => $this
->randomName() . '_test_suffix',
'id' => '4',
'number' => 26,
'array' => $array,
));
$this->entities[] = $entity;
$entity
->enforceIsNew();
$entity
->save();
$array['level1']['level2'] = 3;
$entity = entity_create('config_query_test', array(
'label' => $this
->randomName() . '_test_contains_' . $this
->randomName(),
'id' => '5',
'number' => 53,
'array' => $array,
));
$this->entities[] = $entity;
$entity
->enforceIsNew();
$entity
->save();
}