Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Drupal.org issue queue
Drupal.org issue queue
Security & Compliance
Security & Compliance
Dependency List
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
project
drupal
Commits
37010da9
Commit
37010da9
authored
Aug 22, 2016
by
catch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2787655
: Fix \Drupal\Tests\Core\Form\FormTestBase to not have multiple namespaces
parent
50ab536e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
33 deletions
+42
-33
core/tests/Drupal/Tests/Core/Form/FormTestBase.php
core/tests/Drupal/Tests/Core/Form/FormTestBase.php
+4
-33
core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
.../tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
+38
-0
No files found.
core/tests/Drupal/Tests/Core/Form/FormTestBase.php
View file @
37010da9
<?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
;
}
}
core/tests/Drupal/Tests/Core/Form/fixtures/form_base_test.inc
0 → 100644
View file @
37010da9
<?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
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment