public function EntityFormTest::testSaveSettingsNodeIsNotImported in Acquia Content Hub 8
Tests the saveSettings() method, node is not imported.
@covers ::saveSettings
File
- tests/
src/ Unit/ Form/ EntityFormTest.php, line 250
Class
- EntityFormTest
- PHPUnit test for the EntityForm class.
Namespace
Drupal\Tests\acquia_contenthub\Unit\FormCode
public function testSaveSettingsNodeIsNotImported() {
$form_state = $this
->createMock('Drupal\\Core\\Form\\FormState');
$form_state
->expects($this
->once())
->method('isValueEmpty')
->willReturn(FALSE);
$node = $this
->createMock('\\Drupal\\node\\NodeInterface');
$node
->expects($this
->once())
->method('getEntityTypeId')
->willReturn('node');
$node
->expects($this
->once())
->method('id')
->willReturn(12);
$form_object = $this
->createMock('Drupal\\Core\\Entity\\EntityFormInterface');
$form_object
->expects($this
->once())
->method('getEntity')
->willReturn($node);
$form_state
->expects($this
->once())
->method('getFormObject')
->willReturn($form_object);
$this->contentHubEntitiesTracking
->expects($this
->once())
->method('loadImportedByDrupalEntity')
->with('node', 12)
->willReturn(NULL);
$this->contentHubEntitiesTracking
->expects($this
->never())
->method('hasLocalChange');
$this->entityForm
->saveSettings($form_state);
}