/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. */ protected function setUp() { parent::setUp(); $this->ssh_keys = $this->getMockBuilder(SSHKeys::class)->disableOriginalConstructor()->getMock(); $this->user = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock(); $this->user->expects($this->any())->method('getSSHKeys')->willReturn($this->ssh_keys); $this->session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $this->session->method('getUser')->willReturn($this->user); }
/** * @inheritdoc */ protected function setUp() { parent::setUp(); $this->organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock(); $this->user = $this->getMockBuilder(User::class)->disableOriginalConstructor()->getMock(); $this->session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); $this->session->method('getUser')->with()->willReturn($this->user); $this->command = new ListCommand($this->getConfig()); $this->command->setLogger($this->logger); $this->command->setSession($this->session); }
/** * @inheritdoc */ 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); }