Pantheon\Terminus\UnitTests\Commands\Org\Site\OrgSiteCommandTest::setUp PHP Method

setUp() protected method

protected setUp ( )
    protected function setUp()
    {
        parent::setUp();
        $this->session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock();
        $this->user = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock();
        $this->user_org_memberships = $this->getMockBuilder(UserOrganizationMemberships::class)->disableOriginalConstructor()->getMock();
        $this->user_org_membership = $this->getMockBuilder(UserOrganizationMembership::class)->disableOriginalConstructor()->getMock();
        $this->organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock();
        $this->organization->id = 'org_id';
        $this->session->method('getUser')->with()->willReturn($this->user);
        $this->user->method('getOrgMemberships')->with()->willReturn($this->user_org_memberships);
        $this->user_org_memberships->method('get')->with($this->equalTo($this->organization->id))->willReturn($this->user_org_membership);
        $this->user_org_membership->method('getOrganization')->with()->willReturn($this->organization);
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @inheritdoc
  */
 protected function setUp()
 {
     parent::setUp();
     $this->sites->method('fetch')->with($this->equalTo(['org_id' => $this->organization->id]))->willReturn($this->sites);
     $this->command = new ListCommand($this->getConfig());
     $this->command->setSites($this->sites);
     $this->command->setLogger($this->logger);
     $this->command->setSession($this->session);
 }
All Usage Examples Of Pantheon\Terminus\UnitTests\Commands\Org\Site\OrgSiteCommandTest::setUp
OrgSiteCommandTest