summaryrefslogtreecommitdiff
path: root/modules/syslog/syslog.test
blob: cfac352b21d26efb6317dc24652a3a9b3d88910d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
// $Id$

class SyslogTestCase extends DrupalWebTestCase {
  public static function getInfo() {
    return array(
      'name' => t('Syslog functionality'),
      'description' => t('Test syslog settings.'),
      'group' => t('Syslog')
    );
  }

  function setUp() {
    parent::setUp('syslog');
  }

  /**
   * Test the syslog settings page.
   */
  function testSettings() {
    $admin_user = $this->drupalCreateUser(array('administer site configuration'));
    $this->drupalLogin($admin_user);

    $edit = array();
    // If we're on Windows, LOG_LOCAL6 will not be available.
    if (defined('LOG_LOCAL6')) {
      $edit['syslog_facility'] = LOG_LOCAL6;
    }
    else {
      $edit['syslog_facility'] = LOG_USER;
    }
    $this->drupalPost('admin/settings/logging', $edit, t('Save configuration'));
    $this->assertText(t('The configuration options have been saved.'));

    $this->drupalGet('admin/settings/logging');
    if ($this->parse()) {
      $field = $this->xpath('//option[@value="' . $edit['syslog_facility'] . '"]'); // Should be one field.
      $this->assertTrue($field[0]['selected'] == 'selected', t('Facility value saved.'));
    }
  }
}