Skip to content

Commit

Permalink
add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lavarou committed Apr 11, 2024
1 parent 341a432 commit 55993ce
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/integration/frameworks/yii/test_basic_cli.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

/*DESCRIPTION
The agent should name Yii2 cli transactions
*/

/*EXPECT_METRICS_EXIST
Supportability/framework/Yii2/detected
OtherTransaction/Action/test-integration-cli-action
*/

/*EXPECT_ERROR_EVENTS null */

/* WordPress mock app */
require_once __DIR__.'/yii2/baseyii.php';

$a = new yii\base\InlineAction('test-integration-cli-action');
$a->runWithParams([]);
22 changes: 22 additions & 0 deletions tests/integration/frameworks/yii/test_basic_web.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php
/*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

/*DESCRIPTION
The agent should name Yii2 web transactions
*/

/*EXPECT_METRICS_EXIST
Supportability/framework/Yii2/detected
OtherTransaction/Action/test-integration-web-action
*/

/*EXPECT_ERROR_EVENTS null */

/* WordPress mock app */
require_once __DIR__.'/yii2/baseyii.php';

$a = new yii\base\Action('test-integration-web-action');
$a->runWithParams([]);
46 changes: 46 additions & 0 deletions tests/integration/frameworks/yii/yii2/baseyii.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

/* Mock enough bits of Yii2 infrastructure for naming tests. */

namespace yii\base {

/* Web action */
class Action {
private $uniqid;

public function __construct($argument) {
$this->uniqid = $argument;
}

public function getUniqueId ( ) {
return $this->uniqid;
}

public function runWithParams($params) {
return;
}
}

/* Console action */
class InlineAction {
private $uniqid;

public function __construct($id) {
$this->uniqid = $id;
}

public function getUniqueId ( ) {
return $this->uniqid;
}

public function runWithParams($params) {
return;
}
}
echo "";
}

0 comments on commit 55993ce

Please sign in to comment.