You are here

public function InsertImageTest::testInsertDisabled in Insert 8.2

File

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

Class

InsertImageTest
Tests Insert module's image insert capability.

Namespace

Drupal\Tests\insert\FunctionalJavascript

Code

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