Projet

Général

Profil

Révision e9f59589

Ajouté par Assos Assos il y a presque 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/piwik/piwik.test
275 275
  }
276 276
}
277 277

  
278
class PiwikStatusMessagesTest extends DrupalWebTestCase {
279

  
280
  public static function getInfo() {
281
    return array(
282
      'name' => 'Piwik status messages tests',
283
      'description' => 'Test status messages functionality of Piwik module.',
284
      'group' => 'Piwik',
285
    );
286
  }
287

  
288
  function setUp() {
289
    parent::setUp('piwik');
290

  
291
    $permissions = array(
292
      'access administration pages',
293
      'administer piwik',
294
    );
295

  
296
    // User to set up piwik.
297
    $this->admin_user = $this->drupalCreateUser($permissions);
298
  }
299

  
300
  function testPiwikStatusMessages() {
301
    $ua_code = '1';
302
    variable_set('piwik_site_id', $ua_code);
303

  
304
    // Enable logging of errors only.
305
    variable_set('piwik_trackmessages', array('error' => 'error'));
306

  
307
    $this->drupalPost('user/login', array(), t('Log in'));
308
    $this->assertRaw('_paq.push(["trackEvent", "Messages", "Error message", "Username field is required."]);', '[testPiwikStatusMessages]: trackEvent "Username field is required." is shown.');
309
    $this->assertRaw('_paq.push(["trackEvent", "Messages", "Error message", "Password field is required."]);', '[testPiwikStatusMessages]: trackEvent "Password field is required." is shown.');
310

  
311
    // @todo: investigate why drupal_set_message() fails.
312
    //drupal_set_message('Example status message.', 'status');
313
    //drupal_set_message('Example warning message.', 'warning');
314
    //drupal_set_message('Example error message.', 'error');
315
    //drupal_set_message('Example error <em>message</em> with html tags and <a href="http://example.com/">link</a>.', 'error');
316
    //$this->drupalGet('');
317
    //$this->assertNoRaw('_paq.push(["trackEvent", "Messages", "Status message", "Example status message."]);', '[testPiwikStatusMessages]: Example status message is not enabled for tracking.');
318
    //$this->assertNoRaw('_paq.push(["trackEvent", "Messages", "Warning message", "Example warning message."]);', '[testPiwikStatusMessages]: Example warning message is not enabled for tracking.');
319
    //$this->assertRaw('_paq.push(["trackEvent", "Messages", "Error message", "Example error message."]);', '[testPiwikStatusMessages]: Example error message is shown.');
320
    //$this->assertRaw('_paq.push(["trackEvent", "Messages", "Error message", "Example error message with html tags and link."]);', '[testPiwikStatusMessages]: HTML has been stripped successful from Example error message with html tags and link.');
321
  }
322
}
323

  
278 324
class PiwikRolesTest extends DrupalWebTestCase {
279 325

  
280 326
  public static function getInfo() {

Formats disponibles : Unified diff