Last active
April 21, 2016 15:02
-
-
Save nullvariable/f26495522e481d2c8225f3f610a3d605 to your computer and use it in GitHub Desktop.
Mocking a Drupal 7 core function with namespaces
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Same\As\Class\Testing | |
{ | |
function drupal_valid_token($token = NULL) | |
{ | |
return ($token == "expected value); | |
} | |
class moduleNameTestSuite extendsDrupalWebTestCase | |
{ | |
//static public function getInfo() ... | |
public function setUp() | |
{ | |
parent::setUp(array('moduleName')); | |
} | |
public function testValidate() | |
{ | |
$testData = array(/*...*/); | |
$object = new moduleNameClass($testData); | |
$this->assertEqual($object->key, $testData['key']; | |
} | |
} | |
} | |
namespace | |
{ | |
moduleNameGlobalTest extends \Same\As\Class\Testing\moduleNameTestSuite | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment