コード例 #1
0
ファイル: functions.php プロジェクト: n3b/symfony
/**
 * Stub implementation for the intl_is_failure function of the intl extension
 *
 * @author Bernhard Schussek <*****@*****.**>
 * @param  integer $errorCode  The error code returned by intl_get_error_code()
 * @return Boolean Whether the error code indicates an error
 * @see    Symfony\Component\Locale\Stub\StubIntl::isFailure
 */
function intl_is_failure($errorCode)
{
    return StubIntl::isFailure($errorCode);
}
コード例 #2
0
 /**
  * @dataProvider parseProvider
  */
 public function testParseStub($pattern, $value, $expected, $errorCode = 0, $errorMessage = 'U_ZERO_ERROR')
 {
     $formatter = $this->createStubFormatter($pattern);
     $this->assertSame($expected, $formatter->parse($value));
     $this->assertSame($errorMessage, StubIntl::getErrorMessage());
     $this->assertSame($errorCode, StubIntl::getErrorCode());
     $this->assertSame($errorCode != 0, StubIntl::isFailure(StubIntl::getErrorCode()));
 }
 /**
  * @dataProvider parseErrorProvider
  */
 public function testParseErrorStub($pattern, $value)
 {
     $errorCode = StubIntl::U_PARSE_ERROR;
     $errorMessage = 'Date parsing failed: U_PARSE_ERROR';
     $formatter = $this->createStubFormatter($pattern);
     $this->assertFalse($formatter->parse($value));
     $this->assertSame($errorMessage, StubIntl::getErrorMessage());
     $this->assertSame($errorCode, StubIntl::getErrorCode());
     $this->assertTrue(StubIntl::isFailure(StubIntl::getErrorCode()));
     $this->assertSame($errorMessage, $formatter->getErrorMessage());
     $this->assertSame($errorCode, $formatter->getErrorCode());
     $this->assertTrue(StubIntl::isFailure($formatter->getErrorCode()));
 }
コード例 #4
0
 /**
  * @dataProvider parseProvider
  */
 public function testParseStub($value, $expected, $message = '')
 {
     $formatter = $this->getStubFormatterWithDecimalStyle();
     $parsedValue = $formatter->parse($value, StubNumberFormatter::TYPE_DOUBLE);
     $this->assertSame($expected, $parsedValue, $message);
     if ($expected === false) {
         $errorCode = StubIntl::U_PARSE_ERROR;
         $errorMessage = 'Number parsing failed: U_PARSE_ERROR';
     } else {
         $errorCode = StubIntl::U_ZERO_ERROR;
         $errorMessage = 'U_ZERO_ERROR';
     }
     $this->assertSame($errorMessage, StubIntl::getErrorMessage());
     $this->assertSame($errorCode, StubIntl::getErrorCode());
     $this->assertSame($errorCode !== 0, StubIntl::isFailure(StubIntl::getErrorCode()));
     $this->assertSame($errorMessage, $formatter->getErrorMessage());
     $this->assertSame($errorCode, $formatter->getErrorCode());
     $this->assertSame($errorCode !== 0, StubIntl::isFailure($formatter->getErrorCode()));
 }
コード例 #5
0
ファイル: functions.php プロジェクト: rfc1483/blog
/**
 * Stub implementation for the intl_is_failure function of the intl extension
 *
 * @author Bernhard Schussek <*****@*****.**>
 * @param  integer $errorCode  The error code returned by intl_get_error_code()
 * @return Boolean Whether the error code indicates an error
 * @see    Symfony\Component\Locale\Stub\StubIntl::isFailure
 */
function intl_is_failure($errorCode)
{
    return \Symfony\Component\Locale\Stub\StubIntl::isFailure($errorCode);
}