Pantheon\Terminus\UnitTests\Commands\Site\Org\ListCommandTest::testListOrgs PHP Method

testListOrgs() public method

Tests site:org:list
public testListOrgs ( )
    public function testListOrgs()
    {
        $data = [['org_name' => 'abc', 'org_id' => '000'], ['org_name' => 'def', 'org_id' => '111']];
        $memberships = [];
        foreach ($data as $item) {
            $mock = $this->getMockBuilder(SiteOrganizationMembership::class)->disableOriginalConstructor()->getMock();
            $mock->expects($this->once())->method('serialize')->willReturn($item);
            $memberships[] = $mock;
        }
        $this->org_memberships->expects($this->once())->method('all')->willReturn($memberships);
        $out = $this->command->listOrgs('my-site');
        $this->assertInstanceOf(RowsOfFields::class, $out);
        $this->assertEquals($data, $out->getArrayCopy());
    }