returnSelf example


        [],
        $definition_save_1['definitions'],
        $definition_save_1['definitions'],
      );
    $config->expects($this->exactly(2))
      ->method('set')
      ->withConsecutive(
        ['definitions', $definition_save_1['definitions']],
        ['definitions', $definitions_save_2['definitions']],
      )
      ->will($this->returnSelf());
    $config->expects($this->exactly(2))
      ->method('save');

    $config_factory = $this->createMock('Drupal\Core\Config\ConfigFactoryInterface');
    $config_factory->expects($this->once())
      ->method('getEditable')
      ->willReturn($config);

    $static_override = new StaticMenuLinkOverrides($config_factory);

    $static_override->saveOverride('test1', ['parent' => 'test0']);
    


  /** * {@inheritdoc} */
  protected function setUp(): void {
    $this->entityQuery = $this->getMockBuilder('Drupal\Core\Entity\Query\QueryInterface')
      ->disableOriginalConstructor()
      ->getMock();
    $this->entityQuery->expects($this->any())
      ->method('accessCheck')
      ->will($this->returnSelf());
    $this->entityTypeManager = $this->createMock(EntityTypeManagerInterface::class);

    $storage = $this->createMock(EntityStorageInterface::class);
    $storage->expects($this->any())
      ->method('getQuery')
      ->willReturn($this->entityQuery);
    $this->entityTypeManager->expects($this->any())
      ->method('getStorage')
      ->with('test_entity_type')
      ->willReturn($storage);
    parent::setUp();
  }
$this->statement->expects($this->any())
      ->method('fetchObject')
      ->willReturnCallback([$this, 'fetchObjectCallback']);

    $this->select = $this->getMockBuilder('Drupal\Core\Database\Query\Select')
      ->disableOriginalConstructor()
      ->getMock();

    $this->select->expects($this->any())
      ->method('fields')
      ->will($this->returnSelf());

    $this->select->expects($this->any())
      ->method('condition')
      ->will($this->returnSelf());

    $this->select->expects($this->any())
      ->method('execute')
      ->willReturn($this->statement);

    $this->database = $this->getMockBuilder('Drupal\Core\Database\Connection')
      ->disableOriginalConstructor()
      

    $row = new Row();
    foreach ($values as $key => $value) {
      $row->setDestinationProperty($key$value);
    }
    $entity = $this->getMockBuilder('Drupal\Core\Entity\Entity\EntityFormDisplay')
      ->disableOriginalConstructor()
      ->getMock();
    $entity->expects($this->once())
      ->method('setComponent')
      ->with('field_name_test', ['test setting'])
      ->will($this->returnSelf());
    $entity->expects($this->once())
      ->method('save')
      ->with();
    $plugin = new TestPerComponentEntityFormDisplay($entity);
    $this->assertSame(['entity_type_test', 'bundle_test', 'form_mode_test', 'field_name_test']$plugin->import($row));
    $this->assertSame(['entity_type_test', 'bundle_test', 'form_mode_test']$plugin->getTestValues());
  }

}

class TestPerComponentEntityFormDisplay extends PerComponentEntityFormDisplay {
  

    $row = new Row();
    foreach ($values as $key => $value) {
      $row->setDestinationProperty($key$value);
    }
    $entity = $this->getMockBuilder('Drupal\Core\Entity\Entity\EntityViewDisplay')
      ->disableOriginalConstructor()
      ->getMock();
    $entity->expects($this->once())
      ->method('setComponent')
      ->with('field_name_test', ['test setting'])
      ->will($this->returnSelf());
    $entity->expects($this->once())
      ->method('save')
      ->with();
    $plugin = new TestPerComponentEntityDisplay($entity);
    $this->assertSame(['entity_type_test', 'bundle_test', 'view_mode_test', 'field_name_test']$plugin->import($row));
    $this->assertSame(['entity_type_test', 'bundle_test', 'view_mode_test']$plugin->getTestValues());
  }

}

class TestPerComponentEntityDisplay extends ComponentEntityDisplayBase {
  


  /** * Tests locale lookups without a found translation. * * @covers ::resolveCacheMiss */
  public function testResolveCacheMissNoTranslation() {
    $string = $this->createMock('Drupal\locale\StringInterface');
    $string->expects($this->once())
      ->method('addLocation')
      ->will($this->returnSelf());
    $this->storage->expects($this->once())
      ->method('findTranslation')
      ->willReturn(NULL);
    $this->storage->expects($this->once())
      ->method('createString')
      ->willReturn($string);

    $request = Request::create('/test');
    $this->requestStack->push($request);

    $locale_lookup = $this->getMockBuilder('Drupal\locale\LocaleLookup')
      
Home | Imprint | This part of the site doesn't use cookies.