You are here

public function DataLayerUnitTests::setupMockNode in dataLayer 7

Setup mock node.

7 calls to DataLayerUnitTests::setupMockNode()
DataLayerUnitTests::testDataLayerGetEntityDataReturnsEntityDataArray in tests/datalayer.unit.test
Test DataLayer Get Entity Terms Returns Entity Data Array.
DataLayerUnitTests::testDataLayerGetEntityTermsReturnsEmptyArray in tests/datalayer.unit.test
Test DataLayer Get Entity Terms Returns Empty Array.
DataLayerUnitTests::testDataLayerGetEntityTermsReturnsTermArray in tests/datalayer.unit.test
Test DataLayer Get Entity Terms Returns Term Array.
DataLayerUnitTests::testDataLayerMenuGetAnyObjectReturnsFalseWithIncorrectArgPosition in tests/datalayer.unit.test
Test DataLayer Menu Get Any Object.
DataLayerUnitTests::testDataLayerMenuGetAnyObjectReturnsFalseWithoutLoadFunctionMatch in tests/datalayer.unit.test
Test DataLayer Menu Get Any Object.

... See full list

File

tests/datalayer.unit.test, line 193
Tests the functionality of the DataLayer module.

Class

DataLayerUnitTests
@file Tests the functionality of the DataLayer module.

Code

public function setupMockNode() {

  // Hijack static cache for menu_get_item call.
  $item =& drupal_static('menu_get_item');
  $_GET['q'] = 'node/1';
  $item = array(
    'node/1' => array(
      'load_functions' => array(
        1 => 'node_load',
      ),
      'map' => array(
        'node',
        (object) array(
          'vid' => 1,
          'uid' => 1,
          'title' => 'My Article',
          'status' => 1,
          'nid' => 1,
          'type' => 'article',
          'language' => 'und',
          'created' => '1435019805',
          'changed' => '1435019805',
          'tnid' => 0,
          'name' => 'admin',
          'field_tags' => array(
            'und' => array(
              array(
                'tid' => 1,
                'taxonomy_term' => (object) array(
                  'name' => 'someTag',
                ),
              ),
            ),
          ),
        ),
      ),
    ),
  );

  // Hijack static cache for entity_get_info call.
  $entity =& drupal_static('entity_get_info');
  $entity = array(
    'node' => array(
      'load hook' => 'node_load',
    ),
  );
  return $item;
}