class StatsDTest in StatsD 7.2
Unit tests for statsd.inc
Hierarchy
- class \Drupal\statsd\Tests\StatsDTest extends \Drupal\statsd\Tests\DrupalUnitTestCase
Expanded class hierarchy of StatsDTest
File
- lib/
Drupal/ statsd/ Tests/ StatsDTest.php, line 12 - Tests for statsd module.
Namespace
Drupal\statsd\TestsView source
class StatsDTest extends \DrupalUnitTestCase {
/**
* Describe the test suite.
*/
public static function getInfo() {
return array(
'name' => 'StatsD Unit Test',
'description' => 'Very simple usecase of unit testing the statsd object.',
'group' => 'StatsD',
);
}
/**
* Enable module.
*/
public function setUp() {
parent::setUp('statsd');
}
/**
* Make sure all valid arguments are reflected in new instance.
*/
public function testConstructorArgumentsHappy() {
$parameters = array(
'enabled' => 'foo',
'sampleRate' => 0.42,
'host' => '10.0.0.1',
'port' => 80,
'prefix' => 'pre',
'suffix' => 'suf',
);
$statsd = new \StatsD($parameters);
foreach ($parameters as $name => $value) {
$this
->assertTrue(property_exists($statsd, $name) && $statsd->{$name} == $value, "{$name} is assigned correctly.");
}
}
/**
* Make sure undefined arguments are not reflected in new instance.
*/
public function testConstructorArgumentsSadExtra() {
$parameters = array(
'foo' => 'bar',
);
$statsd = new \StatsD($parameters);
$this
->assertTrue(!isset($statsd->foo), 'Extra parameters are ignored.');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StatsDTest:: |
public static | function | Describe the test suite. | |
StatsDTest:: |
public | function | Enable module. | |
StatsDTest:: |
public | function | Make sure all valid arguments are reflected in new instance. | |
StatsDTest:: |
public | function | Make sure undefined arguments are not reflected in new instance. |