コード例 #1
0
 /**
  * @dataProvider getDataGetDataUrl
  */
 public function testGetDataUrl(array $context, array $query)
 {
     $mockUrl = $this->mock('tubepress_api_url_UrlInterface');
     $mockQuery = $this->mock('tubepress_api_url_QueryInterface');
     foreach ($context as $key => $value) {
         $this->_mockContext->shouldReceive('get')->once()->with($key)->andReturn($value);
     }
     $mockUrl->shouldReceive('getQuery')->once()->andReturn($mockQuery);
     $this->_mockUrlFactory->shouldReceive('fromString')->once()->with('https://www.dailymotion.com/embed/video/xx')->andReturn($mockUrl);
     $this->_mockLangUtils->shouldReceive('booleanToStringOneOrZero')->atLeast(1)->andReturnUsing(function ($incoming) {
         $langutils = new tubepress_util_impl_LangUtils();
         return $langutils->booleanToStringOneOrZero($incoming);
     });
     $this->_mockMediaItem->shouldReceive('getId')->once()->andReturn('xx');
     $expected = array(tubepress_api_template_VariableNames::EMBEDDED_DATA_URL => $mockUrl, 'player_id' => 'player-id');
     foreach ($query as $key => $value) {
         $mockQuery->shouldReceive('set')->once()->with($key, $value);
     }
     $actual = $this->_sut->getTemplateVariables($this->_mockMediaItem);
     $this->assertEquals($expected, $actual);
 }
コード例 #2
0
ファイル: LangUtilsTest.php プロジェクト: tubepress/tubepress
 /**
  * @dataProvider getDataBooleaenToOneOrZero
  */
 public function testBooleanToOneOrZero($expected, $incoming)
 {
     $this->assertEquals($expected, $this->_sut->booleanToStringOneOrZero($incoming));
 }