Unverified Commit 67a30ac6 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3229734 by quietone, danflanagan8, Kristen Pol: Improve test and add...

Issue #3229734 by quietone, danflanagan8, Kristen Pol: Improve test and add comments to ContentEntityTest

(cherry picked from commit 0bed3aee)
parent d6ead31b
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -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',
@@ -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,
@@ -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,
@@ -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);