Loading core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php +10 −5 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ protected function setUp(): void { ['target_bundles' => [$this->vocabulary]], FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED ); // Create a term reference field on user. $this->createEntityReferenceField( 'user', Loading @@ -139,7 +140,8 @@ protected function setUp(): void { FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED ); // Create some data. // Create a node, with data in a term reference field, and then add a French // translation of the node. $this->user = User::create([ 'name' => 'user123', 'uid' => 1, Loading @@ -147,11 +149,12 @@ protected function setUp(): void { ]); $this->user->save(); $this->anon = User::create([ // Add the anonymous user so we can test later that it is not provided in a // source row. User::create([ 'name' => 'anon', 'uid' => 0, ]); $this->anon->save(); ])->save(); $term = Term::create([ 'vid' => $this->vocabulary, Loading Loading @@ -216,7 +219,9 @@ public function testUserSource(array $configuration) { $user_source = $migration->getSourcePlugin(); $this->assertSame('users', $user_source->__toString()); if (!$configuration['include_translations']) { // Confirm that the query does not return a row for the anonymous user. // Confirm that the anonymous user is in the source database but not // included in the rows returned by the content_entity. $this->assertNotNull(User::load(0)); $this->assertEquals(1, $user_source->count()); } $this->assertIds($user_source, $configuration); Loading Loading
core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/ContentEntityTest.php +10 −5 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ protected function setUp(): void { ['target_bundles' => [$this->vocabulary]], FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED ); // Create a term reference field on user. $this->createEntityReferenceField( 'user', Loading @@ -139,7 +140,8 @@ protected function setUp(): void { FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED ); // Create some data. // Create a node, with data in a term reference field, and then add a French // translation of the node. $this->user = User::create([ 'name' => 'user123', 'uid' => 1, Loading @@ -147,11 +149,12 @@ protected function setUp(): void { ]); $this->user->save(); $this->anon = User::create([ // Add the anonymous user so we can test later that it is not provided in a // source row. User::create([ 'name' => 'anon', 'uid' => 0, ]); $this->anon->save(); ])->save(); $term = Term::create([ 'vid' => $this->vocabulary, Loading Loading @@ -216,7 +219,9 @@ public function testUserSource(array $configuration) { $user_source = $migration->getSourcePlugin(); $this->assertSame('users', $user_source->__toString()); if (!$configuration['include_translations']) { // Confirm that the query does not return a row for the anonymous user. // Confirm that the anonymous user is in the source database but not // included in the rows returned by the content_entity. $this->assertNotNull(User::load(0)); $this->assertEquals(1, $user_source->count()); } $this->assertIds($user_source, $configuration); Loading