コード例 #1
0
 public function onSetup()
 {
     $this->_mockLogger = $this->mock(tubepress_api_log_LoggerInterface::_);
     $this->_mockLangUtils = $this->mock(tubepress_api_util_LangUtilsInterface::_);
     $this->_mockUrlFactory = $this->mock(tubepress_api_url_UrlFactoryInterface::_);
     $this->_mockStringUtils = $this->mock(tubepress_api_util_StringUtilsInterface::_);
     $this->_mockLangUtils->shouldReceive('isAssociativeArray')->andReturnUsing(function ($candidate) {
         $util = new tubepress_util_impl_LangUtils();
         return $util->isAssociativeArray($candidate);
     });
     $this->_mockLangUtils->shouldReceive('isSimpleArrayOfStrings')->andReturnUsing(function ($candidate) {
         $util = new tubepress_util_impl_LangUtils();
         return $util->isSimpleArrayOfStrings($candidate);
     });
     $this->_mockUrlFactory->shouldReceive('fromString')->andReturnUsing(function ($candidate) {
         $factory = new tubepress_url_impl_puzzle_UrlFactory();
         return $factory->fromString($candidate);
     });
     $this->_mockStringUtils->shouldReceive('endsWith')->andReturnUsing(function ($haystack, $needle) {
         $utils = new tubepress_util_impl_StringUtils();
         return $utils->endsWith($haystack, $needle);
     });
     $this->_mockLogger->shouldReceive('isEnabled')->atLeast(1)->andReturn(true);
     $this->_mockLogger->shouldReceive('debug');
     $this->_sut = $this->buildSut($this->_mockLogger, $this->_mockUrlFactory, $this->_mockLangUtils, $this->_mockStringUtils);
 }
コード例 #2
0
ファイル: LangUtilsTest.php プロジェクト: tubepress/tubepress
 /**
  * @dataProvider getDataArrayOfStrings
  */
 public function testArrayOfStrings($candidate, $expected)
 {
     $this->assertEquals($expected, $this->_sut->isSimpleArrayOfStrings($candidate));
 }