PHP code example of droptica / drupal-codeception

1. Go to this page and download the library: Download droptica/drupal-codeception library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

droptica / drupal-codeception example snippets


modules:
    - DrupalWatchdog:
        enabled: true
        level: 'ERROR'
        channels:
            my_module: 'NOTICE'
            php: 'WARNING'

// Fill title.
$i->fillTextField(FormField::title(), 'Mans nosukums');

// Select english language for content.
$i->selectOptionFromList(FormField::langcode(), 'en');

// Fill first paragraph of type text.
$page_elements = ParagraphFormField::field_page_elements();
$i->fillWysiwygEditor(FormField::field_text_formatted($page_elements), 'Lorem');

// Remove text paragraph.
$i->removeParagraph($page_elements);

// Add second paragraph of type graybox.
$i->addParagraph('graybox', $page_elements->next());

// Fill title of graybox.
$i->fillTextField(FormField::field_title($page_elements), 'Mans nosukums');

// Fill link field.
$i->fillLinkField(FormField::field_link($page_elements), 'http://example.com', 'Example');
$i->fillLinkField(FormField::field_link($page_elements), 'http://example.com');

// Add taxonomy term reference for tags field.
$field_tags = FormField::field_tags();
$i->fillReferenceField(FormField::field_tags(), Fixtures::get('term1'));
$i->addReferenceFieldItem($field_tags->next());
$i->fillReferenceField($field_tags, Fixtures::get('term2'));

$i->clickOn(FormField::submit());