diff -u b/core/modules/system/tests/src/Unit/Migrate/process/d6/TimeZoneTest.php b/core/modules/system/tests/src/Unit/Migrate/process/d6/TimeZoneTest.php --- b/core/modules/system/tests/src/Unit/Migrate/process/d6/TimeZoneTest.php +++ b/core/modules/system/tests/src/Unit/Migrate/process/d6/TimeZoneTest.php @@ -2,61 +2,35 @@ - /** * @file * Contains \Drupal\Tests\system\Unit\Migrate\process\d6\TimeZoneTest. */ +namespace Drupal\Tests\system\Unit\Migrate\process\d6; -namespace Drupal\Tests\system\Unit\Migrate\source\d6; - -use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase; +use Drupal\system\Plugin\migrate\process\d6\TimeZone; +use Drupal\migrate\Entity\MigrationInterface; +use Drupal\migrate\MigrateExecutableInterface; +use Drupal\migrate\Row; +use Drupal\Tests\migrate\Unit\MigrateTestCase; /** - * Tests D6 time zone process plugin. - * - * @group system + * @coversDefaultClass \Drupal\system\Plugin\migrate\process\d6\TimeZone + * @group save */ -class TimeZoneTest extends MigrateSqlSourceTestCase { - - // The plugin system is not working during unit testing so the source plugin - // class needs to be manually specified. - const PLUGIN_CLASS = 'Drupal\system\Plugin\migrate\process\d6\TimeZone'; - - // The fake Migration configuration entity. - protected $migrationConfiguration = array( - // The ID of the entity, can be any string. - 'id' => 'test', - // Leave it empty for now. - 'idlist' => array(), - // This needs to be the identifier of the actual key: cid for comment, nid - // for node and so on. - 'source' => array( - 'plugin' => 'd6_menu', - ), - ); - - // We need to set up the database contents; it's easier to do that below. - - protected $expectedResults = array( - array( - 'menu_name' => 'menu-name-1', - 'title' => 'menu custom value 1', - 'description' => 'menu custom description value 1', - ), - array( - 'menu_name' => 'menu-name-2', - 'title' => 'menu custom value 2', - 'description' => 'menu custom description value 2', - ), - ); - +class TimeZoneTest extends MigrateTestCase { /** - * {@inheritdoc} + * Tests transformation of image field settings. + * + * @covers ::transform */ - protected function setUp() { - // This array stores the database. - foreach ($this->expectedResults as $k => $row) { - $this->databaseContents['menu_custom'][$k] = $row; - } - parent::setUp(); + public function testTimeZone() { + $migration = $this->getMock(MigrationInterface::class); + $plugin = new TimeZone([], 'd6_timezone', [], $migration); + $executable = $this->getMock(MigrateExecutableInterface::class); + $row = $this->getMockBuilder(Row::class) + ->disableOriginalConstructor() + ->getMock(); + + $value = $plugin->transform([[], ['type' => 'date_default_timezone']], $executable, $row, 'foo'); + $this->assertInternalType('string', $value); + $this->assertSame('UTC',$value); } - -} +} \ No newline at end of file