You are here

mobile_tools_context.test in Mobile Tools 7.2

Same filename and directory in other branches
  1. 7.3 mobile_tools_context/mobile_tools_context.test

Tests for mobile_tools_context

@author Mathew Winstone <mwinstone@coldfrontlabs.ca>

File

mobile_tools_context/mobile_tools_context.test
View source
<?php

/**
 * @file
 * Tests for mobile_tools_context
 *
 * @author Mathew Winstone <mwinstone@coldfrontlabs.ca>
 */
class MobileToolsContextConditionMobileTest extends DrupalWebTestCase {
  protected $profile = 'testing';
  public static function getInfo() {
    return array(
      'name' => 'Condition: Mobile',
      'description' => 'Test mobile condition.',
      'group' => 'Mobile Tools',
    );
  }
  function setUp() {
    parent::setUp('context', 'ctools', 'mobile_tools', 'mobile_tools_context');
    $admin_user = $this
      ->drupalCreateUser(array(
      'administer site configuration',
      'configure mobile tools',
    ));
    $this
      ->drupalLogin($admin_user);
  }
  function test() {

    // Create the context
    ctools_include('export');
    $context = ctools_export_new_object('context');
    $context->name = 'testcontext';

    //$context->conditions = array('path' => array('values' => array('admin', 'node/*')));

    // @todo configure conditions
    $context->reactions = array(
      'debug' => array(
        'debug' => TRUE,
      ),
    );
    $saved = context_save($context);
    $this
      ->assertTrue($saved, "Context 'testcontext' saved.");

    // Configure the mobile tools settings to trigger the mobile context
    // @todo
    // With the debug mode on, Context will print to screen when the context is active
    $this
      ->drupalGet('');

    // @todo figure out what URL to go to test the context
    $this
      ->assertText('Mobile context active: testcontext');

    // Configure the mobile tools settings to not trigger the mobile context
    // @todo
    // @todo repeat tests from above
    // Cleanup
    context_delete($context);

    // @todo: Test with language suffixes
  }

}

Classes

Namesort descending Description
MobileToolsContextConditionMobileTest @file Tests for mobile_tools_context