DisableAlarmActionsTest.php - AWS Code Sample

DisableAlarmActionsTest.php

<?php /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 */ /* Relies on PHPUnit to test the functionality in ./DisableAlarmActions.php. Related custom constants are defined in ./phpunit.xml. Example PHPUnit run command from this file's parent directory: ./vendor/bin/phpunit --testsuite cloudwatch-disablealarmactions */ use PHPUnit\Framework\TestCase; use Aws\MockHandler; use Aws\Result; use Aws\CloudWatch\CloudWatchClient; class DisableAlarmActionsTest extends TestCase { public function testDisableActionsForAnAlarm() { require('./DisableAlarmActions.php'); $alarmNames = array(CLOUDWATCH_ALARM_NAME); $mock = new MockHandler(); $mock->append(new Result(array(true))); $cloudWatchClient = new CloudWatchClient([ 'profile' => AWS_PROFILE, 'version' => CLOUDWATCH_VERSION, 'region' => AWS_REGION, 'handler' => $mock ]); $result = disableAlarmActions($cloudWatchClient, $alarmNames); $this->assertStringContainsString('https://monitoring.' . AWS_REGION . '.amazonaws.com', $result); } }