Namespace
  Drupal\Tests\events_example\Functional
File
  - 
              modules/events_example/tests/src/Functional/EventsExampleTest.php
    
   
  
    View source
  
  <?php
namespace Drupal\Tests\events_example\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
class EventsExampleTest extends BrowserTestBase {
  
  protected $defaultTheme = 'stark';
  
  protected static $modules = [
    'events_example',
  ];
  
  protected $profile = 'minimal';
  
  public function testEventsExample() {
    
    $events_example_form = Url::fromRoute('events_example.description');
    $this->drupalGet($events_example_form);
    $this->assertSession()
      ->statusCodeEquals(200);
    
    $this->assertSession()
      ->fieldExists('incident_type');
    $this->assertSession()
      ->fieldExists('incident');
    
    
    
    
    
    
    
    $values = [
      'incident_type' => 'stolen_princess',
      'incident' => $this->randomString(),
    ];
    $this->drupalGet($events_example_form);
    $this->submitForm($values, 'Submit');
    $this->assertSession()
      ->pageTextContains('Mario has been alerted. Thank you.');
    
    
    $values = [
      'incident_type' => 'joker',
      'incident' => $this->randomString(),
    ];
    $this->drupalGet($events_example_form);
    $this->submitForm($values, 'Submit');
    $this->assertSession()
      ->pageTextContains('Batman has been alerted. Thank you.');
    
    
    $values = [
      'incident_type' => 'cat',
      'incident' => $this->randomString(),
    ];
    $this->drupalGet($events_example_form);
    $this->submitForm($values, 'Submit');
    $this->assertSession()
      ->pageTextContains('notifyDefault()');
  }
}
 
Classes
  
  
  
  
  
  
  
        
      
                                                  | Title | Deprecated | Summary | 
    
    
          
                                                                                        | EventsExampleTest |  | Test the functionality of the Events Example module. |