You are here

public function InsertFileTest::testInsertDisabled in Insert 8.2

File

tests/src/FunctionalJavaScript/InsertFileTest.php, line 15

Class

InsertFileTest
Tests Insert module's generic file insert capability.

Namespace

Drupal\Tests\insert\FunctionalJavascript

Code

public function testInsertDisabled() {
  $fieldName = strtolower($this
    ->randomMachineName());
  $this
    ->createFileField($fieldName);
  $page = $this
    ->getSession()
    ->getPage();
  $files = $this
    ->drupalGetTestFiles('text');
  $this
    ->drupalGet('node/add/article');
  $page
    ->attachFileToField('files[' . $fieldName . '_0]', \Drupal::service('file_system')
    ->realpath($files[0]->uri));
  $this
    ->assertSession()
    ->waitForField($fieldName . '[0][fids]');
  $this
    ->assertEquals(0, count($page
    ->findAll('css', '.insert')), 'Insert container node does not exists');
}