You are here

public function StatsDTest::testConstructorArgumentsHappy in StatsD 7.2

Make sure all valid arguments are reflected in new instance.

File

lib/Drupal/statsd/Tests/StatsDTest.php, line 35
Tests for statsd module.

Class

StatsDTest
Unit tests for statsd.inc

Namespace

Drupal\statsd\Tests

Code

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.");
  }
}