| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 | 
							- <?php
 
- class ContextReactionBlockTest extends DrupalWebTestCase {
 
-   protected $profile = 'testing';
 
-   public static function getInfo() {
 
-     return array(
 
-       'name' => 'Reaction: block',
 
-       'description' => 'Test block reaction.',
 
-       'group' => 'Context',
 
-     );
 
-   }
 
-   function setUp() {
 
-     parent::setUp('context', 'ctools', 'block');
 
-     $admin_user = $this->drupalCreateUser(array(
 
-       'administer site configuration',
 
-       'administer blocks'
 
-     ));
 
-     $this->drupalLogin($admin_user);
 
-   }
 
-   function test() {
 
-     ctools_include('export');
 
-     $context = ctools_export_new_object('context');
 
-     $context->name = 'testcontext';
 
-     $context->conditions = array('sitewide' => array('values' => array(1)));
 
-     $context->reactions = array('block' => array('blocks' => array(
 
-       'user-online' => array(
 
-         'module' => 'user',
 
-         'delta' => 'online',
 
-         'region' => 'sidebar_first',
 
-         'weight' => 0,
 
-       ),
 
-     )));
 
-     $saved = context_save($context);
 
-     $this->assertTrue($saved, "Context 'testcontext' saved.");
 
-     theme_enable(array('bartik'));
 
-     variable_set('theme_default', 'bartik');
 
-     $this->refreshVariables();
 
-     $this->drupalGet('node');
 
-     $this->assertText('Who\'s online');
 
-     // Test title override of code provided block
 
-     $edit = array('title' => 'Context Online Block');
 
-     $this->drupalPost('admin/structure/block/manage/user/online/configure', $edit, t('Save block'));
 
-     $this->drupalPost('admin/config/development/performance', array(), t('Clear all caches'));
 
-     $this->drupalGet('node');
 
-     $this->assertText('Context Online Block');
 
-     // Test title of custom block
 
-     $edit = array(
 
-       'info' => 'Context Custom Block Info',
 
-       'title' => 'Context Custom Block Title',
 
-       'body[value]' => $this->randomName(32),
 
-     );
 
-     $this->drupalPost('admin/structure/block/add', $edit, t('Save block'));
 
-     $bid = db_query("SELECT bid FROM {block_custom} WHERE info = :info", array(':info' => $edit['info']))->fetchField();
 
-     $context->reactions['block']['blocks']["block-{$bid}"] = array(
 
-       'module' => 'block',
 
-       'delta' => $bid,
 
-       'region' => 'sidebar_first',
 
-       'weight' => 2,      
 
-     );
 
-     $saved = context_save($context);
 
-     $this->assertTrue($saved, "Context 'testcontext' saved.");
 
-     $this->drupalGet('node');
 
-     $this->assertText('Context Custom Block Title');
 
-     // Cleanup
 
-     context_delete($context);
 
-   }
 
- }
 
- class ContextReactionBlockAjaxTest extends DrupalWebTestCase {
 
-   protected $profile = 'testing';
 
-   public static function getInfo() {
 
-     return array(
 
-       'name' => 'Reaction: block ajax',
 
-       'description' => 'Test block reaction ajax behavior.',
 
-       'group' => 'Context',
 
-     );
 
-   }
 
-   function setUp() {
 
-     parent::setUp('context', 'context_ui', 'ctools');
 
-     $admin_user = $this->drupalCreateUser(array('context ajax block access'));
 
-     $this->drupalLogin($admin_user);
 
-   }
 
-   function test() {
 
-     $this->drupalGet('node', array(
 
-       'query' => array('context_block' => 'user-online,testcontext')
 
-     ));
 
-     $this->assertText('"status":1', 'Successful return status.');
 
-     $this->assertText('Who\\u0027s online', 'Expected text in block data.');
 
-   }
 
- }
 
- class ContextReactionBlockAjaxAccessTest extends DrupalWebTestCase {
 
-   protected $profile = 'testing';
 
-   public static function getInfo() {
 
-     return array(
 
-       'name' => 'Reaction: block ajax access',
 
-       'description' => 'Test block reaction ajax access behavior.',
 
-       'group' => 'Context',
 
-     );
 
-   }
 
-   function setUp() {
 
-     parent::setUp('context', 'ctools');
 
-     $admin_user = $this->drupalCreateUser();
 
-     $this->drupalLogin($admin_user);
 
-   }
 
-   function test() {
 
-     $this->drupalGet('node', array(
 
-       'query' => array('context_block' => 'user-online,testcontext')
 
-     ));
 
-     $this->assertText('"status":0', 'Failed return status.');
 
-   }
 
- }
 
- class ContextReactionMenuTest extends DrupalWebTestCase {
 
-   protected $profile = 'testing';
 
-   public static function getInfo() {
 
-     return array(
 
-       'name' => 'Reaction: menu',
 
-       'description' => 'Test menu reaction.',
 
-       'group' => 'Context',
 
-     );
 
-   }
 
-   function setUp() {
 
-     parent::setUp('context', 'ctools', 'menu', 'blog');
 
-     $admin_user = $this->drupalCreateUser(array(
 
-       'administer menu',
 
-       'administer nodes',
 
-       'administer site configuration',
 
-       'create blog content',
 
-     ));
 
-     $this->drupalLogin($admin_user);
 
-   }
 
-   function test() {
 
-     ctools_include('export');
 
-     $context = ctools_export_new_object('context');
 
-     $context->name = 'testcontext';
 
-     $context->conditions = array('sitewide' => array('values' => array(1)));
 
-     $context->reactions = array('menu' => 'node/add');
 
-     $saved = context_save($context);
 
-     $this->assertTrue($saved, "Context 'testcontext' saved.");
 
-     $this->drupalPost('admin/structure/menu/settings', array('menu_main_links_source' => 'navigation'), 'Save configuration');
 
-     theme_enable(array('bartik'));
 
-     variable_set('theme_default', 'bartik');
 
-     $this->refreshVariables();
 
-     $output = $this->drupalGet('user');
 
-     $url = url('node/add');
 
-     $active = $this->xpath('//li[contains(@class, "active")]/a[@href="' . $url . '"]');
 
-     $this->assertTrue(!empty($active), t('Active menu item found.'));
 
-     // Cleanup
 
-     context_delete($context);
 
-   }
 
- }
 
- class ContextReactionBreadcrumbTest extends DrupalWebTestCase {
 
-   protected $profile = 'testing';
 
-   public static function getInfo() {
 
-     return array(
 
-       'name' => 'Reaction: breadcrumb',
 
-       'description' => 'Test breadcrumb reaction.',
 
-       'group' => 'Context',
 
-     );
 
-   }
 
-   function setUp() {
 
-     parent::setUp('context', 'ctools');
 
-     $admin_user = $this->drupalCreateUser(array(
 
-       'access administration pages',
 
-       'administer nodes',
 
-       'administer site configuration'
 
-     ));
 
-     $this->drupalLogin($admin_user);
 
-   }
 
-   function test() {
 
-     ctools_include('export');
 
-     $context = ctools_export_new_object('context');
 
-     $context->name = 'testcontext';
 
-     $context->conditions = array('path' => array('values' => array('node')));
 
-     $context->reactions = array('breadcrumb' => 'admin/structure');
 
-     $saved = context_save($context);
 
-     $this->assertTrue($saved, "Context 'testcontext' saved.");
 
-     theme_enable(array('bartik'));
 
-     variable_set('theme_default', 'bartik');
 
-     $this->refreshVariables();
 
-     $output = $this->drupalGet('node');
 
-     $this->assertText('Home » Administration » Structure');
 
-     $output = $this->drupalGet('user');
 
-     $this->assertNoText('Home » Administration » Structure');
 
-     // Cleanup
 
-     context_delete($context);
 
-   }
 
- }
 
- class ContextReactionThemeHtmlTest extends DrupalWebTestCase {
 
-   protected $profile = 'testing';
 
-   public static function getInfo() {
 
-     return array(
 
-       'name' => 'Reaction: theme html',
 
-       'description' => 'Test theme html reaction.',
 
-       'group' => 'Context',
 
-     );
 
-   }
 
-   function setUp() {
 
-     parent::setUp('context', 'ctools');
 
-     $admin_user = $this->drupalCreateUser(array(
 
-       'access administration pages',
 
-       'administer nodes',
 
-       'administer site configuration'
 
-     ));
 
-     $this->drupalLogin($admin_user);
 
-   }
 
-   function test() {
 
-     ctools_include('export');
 
-     $context = ctools_export_new_object('context');
 
-     $context->name = 'testcontext';
 
-     $context->conditions = array('sitewide' => array('values' => array(1)));
 
-     $context->reactions = array('theme_html' => array('class' => 'context-test-class'));
 
-     $saved = context_save($context);
 
-     $this->assertTrue($saved, "Context 'testcontext' saved.");
 
-     $output = $this->drupalGet('node');
 
-     $this->assertRaw('context-test-class');
 
-     // Cleanup
 
-     context_delete($context);
 
-   }
 
- }
 
- class ContextReactionRegionTest extends DrupalWebTestCase {
 
-   protected $profile = 'testing';
 
-   public static function getInfo() {
 
-     return array(
 
-       'name' => 'Reaction: Region',
 
-       'description' => 'Test Region disable reaction.',
 
-       'group' => 'Context',
 
-     );
 
-   }
 
-   function setUp() {
 
-     parent::setUp('context', 'ctools');
 
-     $admin_user = $this->drupalCreateUser(array(
 
-       'access administration pages',
 
-       'administer nodes',
 
-       'administer site configuration'
 
-     ));
 
-     $this->drupalLogin($admin_user);
 
-   }
 
-   function test() {
 
-     ctools_include('export');
 
-     theme_enable(array('bartik'));
 
-     variable_set('theme_default', 'bartik');
 
-     global $theme;
 
-     $context = ctools_export_new_object('context');
 
-     $context->name = 'testcontext';
 
-     $context->conditions = array('sitewide' => array('values' => array(1)));
 
-     $context->reactions = array(
 
-       'block' => array(
 
-         'blocks' => array(
 
-           'user-online' => array(
 
-             'module' => 'user',
 
-             'delta' => 'online',
 
-             'region' => 'sidebar_first',
 
-             'weight' => '-10',
 
-           ),
 
-         ),
 
-       ),
 
-       'region' => array('bartik' => array('disable' => array('sidebar_first' => 'sidebar_first')))
 
-     );
 
-     $saved = context_save($context);
 
-     $this->assertTrue($saved, "Context 'testcontext' saved.");
 
-     $output = $this->drupalGet('node');
 
-     $this->assertNoText("Who's online");
 
-     // Cleanup
 
-     context_delete($context);
 
-   }
 
- }
 
 
  |