You are here

protected function MultigraphUnitTest::getMockSensor in Monitoring 8

Returns a mock SensorConfig entity.

Parameters

array $id: An ID to set on the sensor.

Return value

\Drupal\monitoring\Entity\SensorConfig|\PHPUnit_Framework_MockObject_MockObject The mock sensor object.

1 call to MultigraphUnitTest::getMockSensor()
MultigraphUnitTest::testCalculateDependencies in modules/multigraph/tests/src/Unit/Entity/MultigraphUnitTest.php
@covers ::calculateDependencies

File

modules/multigraph/tests/src/Unit/Entity/MultigraphUnitTest.php, line 84

Class

MultigraphUnitTest
@coversDefaultClass \Drupal\monitoring_multigraph\Entity\Multigraph

Namespace

Drupal\Tests\monitoring_multigraph\Unit\Entity

Code

protected function getMockSensor($id) {
  $sensor1 = $this
    ->getMockBuilder(SensorConfig::class)
    ->setConstructorArgs([
    [],
    'monitoring_sensor_config',
  ])
    ->getMock();
  $sensor1
    ->expects($this
    ->any())
    ->method('getConfigDependencyName')
    ->willReturn("sensor.{$id}");
  return $sensor1;
}