<?php
-namespace Drupal\system\Tests\Form;
+namespace Drupal\Tests\system\Functional\Form;
use Drupal\Component\Serialization\Json;
-use Drupal\simpletest\WebTestBase;
+use Drupal\Tests\BrowserTestBase;
/**
* Tests the form API email element.
*
* @group Form
*/
-class EmailTest extends WebTestBase {
+class EmailTest extends BrowserTestBase {
/**
* Modules to enable.
*/
public static $modules = ['form_test'];
- protected $profile = 'testing';
-
/**
* Tests that #type 'email' fields are properly validated.
*/
$edit = [];
$edit['email_required'] = ' foo.bar@example.com ';
- $values = Json::decode($this->drupalPostForm('form-test/email', $edit, 'Submit'));
+ $this->drupalPostForm('form-test/email', $edit, 'Submit');
+ $values = Json::decode($this->getSession()->getPage()->getContent());
$this->assertIdentical($values['email'], '');
$this->assertEqual($values['email_required'], 'foo.bar@example.com');
$edit = [];
$edit['email'] = 'foo@example.com';
$edit['email_required'] = 'example@drupal.org';
- $values = Json::decode($this->drupalPostForm('form-test/email', $edit, 'Submit'));
+ $this->drupalPostForm('form-test/email', $edit, 'Submit');
+ $values = Json::decode($this->getSession()->getPage()->getContent());
$this->assertEqual($values['email'], 'foo@example.com');
$this->assertEqual($values['email_required'], 'example@drupal.org');
}