protected function setUp()
 {
     parent::setUp();
     entity_create('field_storage_config', array('entity_type' => 'entity_test', 'field_name' => 'image_test', 'type' => 'image', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     entity_create('field_config', array('entity_type' => 'entity_test', 'field_name' => 'image_test', 'bundle' => 'entity_test'))->save();
     file_unmanaged_copy(DRUPAL_ROOT . '/core/misc/druplicon.png', 'public://example.jpg');
     $this->image = entity_create('file', array('uri' => 'public://example.jpg'));
     $this->image->save();
     $this->imageFactory = $this->container->get('image.factory');
 }
Exemplo n.º 2
0
 protected function setUp()
 {
     parent::setUp();
     FieldStorageConfig::create(array('entity_type' => 'entity_test', 'field_name' => 'image_test', 'type' => 'image', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     FieldConfig::create(['entity_type' => 'entity_test', 'field_name' => 'image_test', 'bundle' => 'entity_test'])->save();
     file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg');
     $this->image = File::create(['uri' => 'public://example.jpg']);
     $this->image->save();
     $this->imageFactory = $this->container->get('image.factory');
 }
Exemplo n.º 3
0
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('file');
     $this->installSchema('file', array('file_usage'));
     entity_create('field_storage_config', array('field_name' => 'file_test', 'entity_type' => 'entity_test', 'type' => 'file', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     entity_create('field_config', array('entity_type' => 'entity_test', 'field_name' => 'file_test', 'bundle' => 'entity_test'))->save();
     file_put_contents('public://example.txt', $this->randomMachineName());
     $this->file = entity_create('file', array('uri' => 'public://example.txt'));
     $this->file->save();
 }
Exemplo n.º 4
0
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('file');
     $this->installSchema('file', array('file_usage'));
     FieldStorageConfig::create(array('field_name' => 'file_test', 'entity_type' => 'entity_test', 'type' => 'file', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED))->save();
     $this->directory = $this->getRandomGenerator()->name(8);
     FieldConfig::create(['entity_type' => 'entity_test', 'field_name' => 'file_test', 'bundle' => 'entity_test', 'settings' => array('file_directory' => $this->directory)])->save();
     file_put_contents('public://example.txt', $this->randomMachineName());
     $this->file = File::create(['uri' => 'public://example.txt']);
     $this->file->save();
 }