6b7f13727e1638d5e8f674a933065010861f0b34
[yaffs-website] / web / core / modules / datetime / tests / src / Unit / Plugin / migrate / field / DateFieldTest.php
1 <?php
2
3 namespace Drupal\Tests\datetime\Unit\Plugin\migrate\field;
4
5 use Drupal\datetime\Plugin\migrate\field\DateField;
6 use Drupal\migrate\MigrateException;
7 use Drupal\Tests\UnitTestCase;
8
9 /**
10  * @group migrate
11  */
12 class DateFieldTest extends UnitTestCase {
13
14   /**
15    * @var \Drupal\migrate_drupal\Plugin\MigrateFieldInterface
16    */
17   protected $plugin;
18
19   /**
20    * @var \Drupal\migrate\Plugin\MigrationInterface
21    */
22   protected $migration;
23
24   /**
25    * Tests an Exception is thrown when the field type is not a known date type.
26    */
27   public function testUnknownDateType() {
28     $this->migration = $this->prophesize('Drupal\migrate\Plugin\MigrationInterface')->reveal();
29     $this->plugin = new DateField([], '', []);
30
31     $this->setExpectedException(MigrateException::class, "Field field_date of type 'timestamp' is an unknown date field type.");
32     $this->plugin->processFieldValues($this->migration, 'field_date', ['type' => 'timestamp']);
33   }
34
35 }