/**
  * Test getRow method.
  *
  * @covers ::__construct
  * @covers ::getRow
  */
 public function testGetRow()
 {
     $migration = $this->prophesize('\\Drupal\\migrate\\Plugin\\MigrationInterface')->reveal();
     $message_service = $this->prophesize('\\Drupal\\migrate\\MigrateMessageInterface')->reveal();
     $row = $this->prophesize('\\Drupal\\migrate\\Row')->reveal();
     $event = new MigratePreRowSaveEvent($migration, $message_service, $row);
     $this->assertSame($row, $event->getRow());
 }
Exemplo n.º 2
0
 /**
  * Constructs a post-save event object.
  *
  * @param \Drupal\migrate\Plugin\MigrationInterface $migration
  *   Migration entity.
  * @param \Drupal\migrate\Row $row
  *   Row object.
  * @param array|bool $destination_id_values
  *   Values represent the destination ID.
  */
 public function __construct(MigrationInterface $migration, Row $row, $destination_id_values)
 {
     parent::__construct($migration, $row);
     $this->destinationIdValues = $destination_id_values;
 }
Exemplo n.º 3
0
 /**
  * Reacts to pre-row-save event.
  *
  * @param \Drupal\Migrate\Event\MigratePreRowSaveEvent $event
  *   The migration event.
  * @param string $name
  *   The event name.
  */
 public function preRowSaveEventRecorder(MigratePreRowSaveEvent $event, $name)
 {
     $this->state->set('migrate_events_test.pre_row_save_event', array('event_name' => $name, 'migration' => $event->getMigration(), 'row' => $event->getRow()));
 }
 /**
  * React to an item about to be imported.
  *
  * @param \Drupal\migrate\Event\MigratePreRowSaveEvent $event
  *   The pre-save event.
  */
 public function onPreRowSave(MigratePreRowSaveEvent $event)
 {
     $id_map = $event->getRow()->getIdMap();
     if (!empty($id_map['destid1'])) {
         $this->preExistingItem = TRUE;
     } else {
         $this->preExistingItem = FALSE;
     }
 }