protected function getTeamId($name) { $organization = $this->configProvider->getOrganization(); if (!$this->teams) { $teamsApi = $this->getTeamsApi(); $teams = $teamsApi->all($organization); if (is_array($teams)) { foreach ($teams as $team) { $this->teams[$team['name']] = $team['id']; } } } if (!isset($this->teams[$name])) { throw new InvalidConfigurationException("GitHub team \"{$name}\" not exist in organization \"{$organization}\"."); } return $this->teams[$name]; }
/** * @dataProvider getTeamsDataProvider */ public function testGetTeams($teams, $expected) { $this->configManager->expects($this->once())->method('get')->with(ConfigurationProvider::TEAMS_FIELD)->will($this->returnValue($teams)); $actual = $this->provider->getTeams(); $this->assertEquals($expected, $actual); }