예제 #1
0
 /**
  * @dataProvider getData
  */
 public function testFetch($codeKey, $apiResponse, $expected)
 {
     $mockUrl = $this->mock(tubepress_api_url_UrlInterface::_);
     $this->_mockUrlFactory->shouldReceive('fromString')->once()->with('https://foo.com/bar')->andReturn($mockUrl);
     $this->_mockApiUtility->shouldReceive('getDecodedApiResponse')->once()->with($mockUrl)->andReturn(json_decode($apiResponse, true));
     $sut = new tubepress_dailymotion_impl_dmapi_LanguageSupplier($this->_mockUrlFactory, $this->_stringUtils, $this->_mockApiUtility, 'https://foo.com/bar', $codeKey);
     $actual = $sut->getValueMap();
     $this->assertEquals($expected, $actual);
 }
 public function onAcceptableValues(tubepress_api_event_EventInterface $event)
 {
     if (!isset($this->_acceptableValues)) {
         $this->_acceptableValues = $this->_supplier->getValueMap();
     }
     $current = $event->getSubject();
     if (!is_array($current)) {
         $current = array();
     }
     $event->setSubject(array_merge($current, $this->_acceptableValues));
 }