public function testThatSettingAnAuthorizationKeyIsPropagatedToAllLayers() { $blizzardServiceMock = $this->getMock('\\petrepatrasc\\StarcraftConnectionLayer\\Service\\BlizzardApi', array('setAuthorizationToken')); $blizzardServiceMock->expects($this->atLeastOnce())->method('setAuthorizationToken')->withAnyParameters()->will($this->returnValue($blizzardServiceMock)); $connectivityLayerMock = $this->getMock('\\petrepatrasc\\StarcraftConnectionLayer\\Service\\ConnectionService', array('getBlizzardApi')); $connectivityLayerMock->expects($this->atLeastOnce())->method('getBlizzardApi')->withAnyParameters()->will($this->returnValue($blizzardServiceMock)); $this->callServiceMock->expects($this->atLeastOnce())->method('getConnectivityLayer')->withAnyParameters()->will($this->returnValue($connectivityLayerMock)); $sampleAuthorizationToken = "TEST"; $this->apiService->setAuthorizationToken($sampleAuthorizationToken); $this->assertEquals($sampleAuthorizationToken, $this->apiService->getAuthorizationToken()); }
/** * @expectedException \petrepatrasc\BlizzardApiBundle\Entity\Exception\BlizzardApiException * @expectedExceptionMessage Invalid Application */ public function testThatAnInvalidApplicationKeyWillNotWork() { $this->apiService->setAuthorizationToken("BNET c1fbf21b79c03191d:+3fE0RaKc+PqxN0gi8va5GQC35A="); $this->apiService->getPlayerProfile(\petrepatrasc\BlizzardApiBundle\Entity\Region::Europe, 2048419, 'LionHeart'); }