Skip to content

Instantly share code, notes, and snippets.

@typhonius
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typhonius/bc254b8fab56d228d068 to your computer and use it in GitHub Desktop.
Save typhonius/bc254b8fab56d228d068 to your computer and use it in GitHub Desktop.
diff --git a/docroot/core/modules/path/tests/src/Field/PathFieldDefinitionTest.php b/docroot/core/m
index 89d4f6c..7be7013 100644
--- a/docroot/core/modules/path/tests/src/Field/PathFieldDefinitionTest.php
+++ b/docroot/core/modules/path/tests/src/Field/PathFieldDefinitionTest.php
@@ -41,9 +41,16 @@ protected function getPluginId() {
/**
* {@inheritdoc}
*/
+ protected function getModuleName() {
+ return 'path';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
protected function getNamespacePath() {
// @todo Remove this distinction after issue #2247991.
- return is_dir($dir_psr4 = dirname(__DIR__) . '/src')
+ return is_dir($dir_psr4 = dirname(dirname(dirname(__DIR__))) . '/src')
// After the PSR-4 transition.
? $dir_psr4
// Before the PSR-4 transition.
diff --git a/docroot/core/tests/Drupal/Tests/Core/Field/FieldDefinitionTestBase.php b/docroot/core/
index 49a3922..88bd0d8 100644
--- a/docroot/core/tests/Drupal/Tests/Core/Field/FieldDefinitionTestBase.php
+++ b/docroot/core/tests/Drupal/Tests/Core/Field/FieldDefinitionTestBase.php
@@ -32,7 +32,7 @@ public function setUp() {
// Suppport both PSR-0 and PSR-4 directory layouts.
$module_name = basename($namespace_path);
if ($module_name == 'src') {
- $module_name = basename($module_name);
+ $module_name = $this->getModuleName();
}
$namespaces = new \ArrayObject(array(
'Drupal\\' . $module_name => $namespace_path,
@@ -72,6 +72,14 @@ public function setUp() {
abstract protected function getPluginId();
/**
+ * Returns the module name providing the tested field type.
+ *
+ * @return string
+ * The Module name..
+ */
+ abstract protected function getModuleName();
+
+ /**
* Returns the path to the module's classes.
*
* Depending on whether the module follows the PSR-0 or PSR-4 directory layout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment