public function testCreate() { $workflows = $this->getMockBuilder(Workflows::class)->disableOriginalConstructor()->getMock(); $organization = $this->getMockBuilder(Organization::class)->disableOriginalConstructor()->getMock(); $organization->expects($this->once())->method('getWorkflows')->willReturn($workflows); $site = (object) ['id' => '123']; $workflows->expects($this->once())->method('create')->with('add_organization_site_membership', ['params' => ['site_id' => '123', 'role' => 'team_member']]); $org_site_membership = new OrganizationSiteMemberships(['organization' => $organization]); $org_site_membership->create($site); }
/** * @inheritdoc */ protected function setUp() { parent::setUp(); $this->site->id = 'site_id'; $this->org_site_membership = $this->getMockBuilder(OrganizationSiteMembership::class)->disableOriginalConstructor()->getMock(); $this->org_site_membership->site = $this->site; $this->org_site_memberships = $this->getMockBuilder(OrganizationSiteMemberships::class)->disableOriginalConstructor()->getMock(); $this->org_site_memberships->method('get')->with($this->site->id)->willReturn($this->org_site_membership); $this->organization->method('getSiteMemberships')->with()->willReturn($this->org_site_memberships); $this->command = new RemoveCommand($this->getConfig()); $this->command->setSites($this->sites); $this->command->setLogger($this->logger); $this->command->setSession($this->session); }