Issue #2787655: Fix \Drupal\Tests\Core\Form\FormTestBase to not have multiple namespaces
parent
50ab536e79
commit
37010da991
|
@ -1,6 +1,6 @@
|
|||
<?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 @@ abstract class FormTestBase extends UnitTestCase {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<?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;
|
||||
}
|
Loading…
Reference in New Issue