Skip to content

Commit 185c263

Browse files
committed
Add new tests.
1 parent 40f9659 commit 185c263

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

tests/Functional/OrgCommandsTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,40 @@ public function testOrgSiteListCommand()
153153
);
154154
}
155155

156+
/**
157+
* @test
158+
* @covers \Pantheon\Terminus\Commands\Org\Site\ListCommand
159+
*
160+
* @group org
161+
* @group short
162+
*/
163+
public function testOrgSiteListCommandWithLabelField()
164+
{
165+
$orgSites = $this->terminusJsonResponse(
166+
"org:site:list --fields=id,label" . $this->getOrg()
167+
);
168+
$this->assertIsArray(
169+
$orgSites,
170+
"Response from org list should be an array of orgs"
171+
);
172+
$site = array_shift($orgSites);
173+
174+
$this->assertIsArray(
175+
$site,
176+
"row from org list array of orgs should be an org item"
177+
);
178+
$this->assertArrayHasKey(
179+
'id',
180+
$site,
181+
"Sites from org list should have an id property"
182+
);
183+
$this->assertArrayHasKey(
184+
'label',
185+
$site,
186+
"Sites from org list should have a name property"
187+
);
188+
}
189+
156190
/**
157191
* @test
158192
* @covers \Pantheon\Terminus\Commands\Org\Upstream\ListCommand

tests/Functional/SiteCommandsTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@ public function testSiteListCommand()
3232
$this->assertArrayHasKey('memberships', $site);
3333
}
3434

35+
/**
36+
* @test
37+
* @covers \Pantheon\Terminus\Commands\Site\ListCommand
38+
*
39+
* @group site
40+
* @group short
41+
*/
42+
public function testSiteListCommandWithLabelField()
43+
{
44+
$siteList = $this->terminusJsonResponse(sprintf('site:list --org=%s --fields=id,label', $this->getOrg()));
45+
$this->assertIsArray($siteList);
46+
$this->assertGreaterThan(0, count($siteList));
47+
48+
$site = array_shift($siteList);
49+
$this->assertArrayHasKey('id', $site);
50+
$this->assertArrayHasKey('label', $site);
51+
}
52+
3553
/**
3654
* @test
3755
* @covers \Pantheon\Terminus\Commands\Site\Org\ListCommand

0 commit comments

Comments
 (0)