Skip to content

Commit

Permalink
Merge pull request #2098 from pantheon-systems/plan
Browse files Browse the repository at this point in the history
[BUGS-3082] Bugfix for plan:info command, the site object was not set resulting i…
  • Loading branch information
marktheunissen authored Oct 30, 2020
2 parents 08fda0d + d21f213 commit a1188b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Models/Plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public function __construct($attributes = null, array $options = [])
$attributes = (object)$attributes->attributes;
}
parent::__construct($attributes, $options);
if (isset($options['site'])) {
$this->setSite($options['site']);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/Commands/Plan/ListCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testListPlans()
['id' => 'master', 'sku' => 'xxx'],
['id' => 'another', 'sku' => 'yyy'],
];

$plans_collection = $this->getMockBuilder(Plans::class)
->disableOriginalConstructor()
->getMock();
Expand Down
6 changes: 5 additions & 1 deletion tests/unit_tests/Models/PlanTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Pantheon\Terminus\UnitTests\Models;

use Pantheon\Terminus\Collections\Plans;
use Pantheon\Terminus\Models\Site;
use Pantheon\Terminus\Models\Plan;

/**
Expand Down Expand Up @@ -30,6 +31,9 @@ public function setUp()
$this->plans = $this->getMockBuilder(Plans::class)
->disableOriginalConstructor()
->getMock();
$this->site = $this->getMockBuilder(Site::class)
->disableOriginalConstructor()
->getMock();
$this->data = [
'monthly_collection' => [
'attributes' => [
Expand Down Expand Up @@ -203,7 +207,7 @@ public function testSerialize()
*/
protected function makePlan(array $attributes = [])
{
$model = new Plan((object)$attributes, ['collection' => $this->plans,]);
$model = new Plan((object)$attributes, ['collection' => $this->plans,'site' => $this->site,]);
$model->setConfig($this->config);
$model->setRequest($this->request);
return $model;
Expand Down

0 comments on commit a1188b2

Please sign in to comment.