/** * @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); }