Commit 37010da9 authored by catch's avatar catch

Issue #2787655: Fix \Drupal\Tests\Core\Form\FormTestBase to not have multiple namespaces

parent 50ab536e
<?php
namespace Drupal\Tests\Core\Form {
namespace Drupal\Tests\Core\Form;
use Drupal\Component\Utility\Html;
use Drupal\Core\Form\FormBuilder;
......@@ -147,6 +147,9 @@ abstract class FormTestBase extends UnitTestCase {
protected function setUp() {
parent::setUp();
// Add functions to the global namespace for testing.
require_once __DIR__ . '/fixtures/form_base_test.inc';
$this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface');
$this->formCache = $this->getMock('Drupal\Core\Form\FormCacheInterface');
......@@ -311,35 +314,3 @@ public function getInfo($type) {
}
}
}
namespace {
function test_form_id() {
$form['test'] = array(
'#type' => 'textfield',
'#title' => 'Test',
);
$form['options'] = array(
'#type' => 'radios',
'#options' => array(
'foo' => 'foo',
'bar' => 'bar',
),
);
$form['value'] = array(
'#type' => 'value',
'#value' => 'bananas',
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
);
return $form;
}
}
<?php
/**
* @file
* Functions in the global namespace for \Drupal\Tests\Core\Form\FormTestBase.
*/
/**
* Creates a test form.
*
* @return array
* The form array
*/
function test_form_id() {
$form['test'] = array(
'#type' => 'textfield',
'#title' => 'Test',
);
$form['options'] = array(
'#type' => 'radios',
'#options' => array(
'foo' => 'foo',
'bar' => 'bar',
),
);
$form['value'] = array(
'#type' => 'value',
'#value' => 'bananas',
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => 'Submit',
);
return $form;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment