diff --git a/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php b/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php index c35a443..cf2fe24 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Form/FormObjectTest.php @@ -7,12 +7,13 @@ namespace Drupal\system\Tests\Form; -use Drupal\simpletest\WebTestBase; +use Drupal\system\Tests\System\SystemConfigFormBase; +use Drupal\form_test\FormTestObject; /** * Tests building a form from an object. */ -class FormObjectTest extends WebTestBase { +class FormObjectTest extends SystemConfigFormBase { /** * Modules to enable. @@ -29,6 +30,19 @@ public static function getInfo() { ); } + protected function setUp() { + parent::setUp(); + + $this->form_id = new FormTestObject(); + $this->values = array( + 'bananas' => array( + '#value' => $this->randomString(10), + '#config_name' => 'form_test.object', + '#config_key' => 'bananas', + ), + ); + } + /** * Tests using an object as the form callback. */ diff --git a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestObject.php b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestObject.php index f08d88e..22b6d7a 100644 --- a/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestObject.php +++ b/core/modules/system/tests/modules/form_test/lib/Drupal/form_test/FormTestObject.php @@ -27,6 +27,11 @@ public function getFormID() { public function buildForm(array $form, array &$form_state) { $form['element'] = array('#markup' => 'The FormTestObject::buildForm() method was used for this form.'); + $form['bananas'] = array( + '#type' => 'textfield', + '#title' => t('Bananas'), + ); + $form['actions']['#type'] = 'actions'; $form['actions']['submit'] = array( '#type' => 'submit', @@ -47,6 +52,9 @@ public function validateForm(array &$form, array &$form_state) { */ public function submitForm(array &$form, array &$form_state) { drupal_set_message(t('The FormTestObject::submitForm() method was used for this form.')); + config('form_test.object') + ->set('bananas', $form_state['values']['bananas']) + ->save(); } }