Skip to content

Commit 8141f17

Browse files
committed
Add a test
1 parent bef36de commit 8141f17

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\NewRelicReporting\Plugin;
7+
8+
use Magento\Framework\App\State;
9+
use Magento\NewRelicReporting\Model\NewRelicWrapper;
10+
use Magento\TestFramework\ObjectManager;
11+
use Magento\TestFramework\Helper\Bootstrap;
12+
13+
class SeparateAppsTest extends \PHPUnit\Framework\TestCase
14+
{
15+
/**
16+
* @var ObjectManager
17+
*/
18+
private $objectManager;
19+
20+
protected function setUp()
21+
{
22+
$this->objectManager = Bootstrap::getObjectManager();
23+
}
24+
25+
/**
26+
* @magentoConfigFixture default/newrelicreporting/general/enable 1
27+
* @magentoConfigFixture default/newrelicreporting/general/app_name beverly_hills
28+
* @magentoConfigFixture default/newrelicreporting/general/separate_apps 1
29+
*/
30+
public function testAppNameIsSetWhenConfiguredCorrectly()
31+
{
32+
$newRelicWrapper = $this->getMockBuilder(NewRelicWrapper::class)
33+
->setMethods(['setAppName'])
34+
->getMock();
35+
36+
$this->objectManager->configure([NewRelicWrapper::class => ['shared' => true]]);
37+
$this->objectManager->addSharedInstance($newRelicWrapper, NewRelicWrapper::class);
38+
39+
$newRelicWrapper->expects($this->once())
40+
->method('setAppName')
41+
->with($this->equalTo('beverly_hills;beverly_hills_90210'));
42+
43+
$state = $this->objectManager->get(State::class);
44+
45+
$state->setAreaCode('90210');
46+
}
47+
}

0 commit comments

Comments
 (0)