Skip to content

Commit

Permalink
Fetch NewRelic info before outputting it
Browse files Browse the repository at this point in the history
  • Loading branch information
rvtraveller authored and tesladethray committed Mar 8, 2017
1 parent 6a054a7 commit 5277c47
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file. This projec

### Fixed
- Fixed the base branch in the URL when checking for upstream updates. (#1581)
- Fixed `new-relic:info` by changing NewRelic::serialize() to fetch its data before attempting to return it. (#1648)

## 1.0.0 - 2017-01-20
### Added
Expand Down
1 change: 1 addition & 0 deletions src/Models/NewRelic.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function enable()
*/
public function serialize()
{
$this->fetch();
if (empty($name = $this->get('name'))) {
return [];
}
Expand Down
16 changes: 1 addition & 15 deletions tests/unit_tests/Models/NewRelicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,7 @@ public function testSerialize()
)
->willReturn(['data' => $attributes,]);

$data = $this->model->fetch()->serialize();
$data = $this->model->serialize();
$this->assertEquals($desired_data, $data);
}

/**
* Tests NewRelic::serialize() without a name
*/
public function testSerializeNoName()
{
$this->request->expects($this->never())
->method('request');
$this->model = new NewRelic((object)[], ['site' => $this->site,]);
$this->model->setRequest($this->request);

$out = $this->model->serialize();
$this->assertEquals([], $out);
}
}

0 comments on commit 5277c47

Please sign in to comment.