assertStringMatchesFormat() public static method

Asserts that a string matches a given format string.
public static assertStringMatchesFormat ( string $format, string $string, string $message = '' )
$format string
$string string
$message string
コード例 #1
0
ファイル: SpecsTest.php プロジェクト: lastguest/yay
 function run()
 {
     $raw = is_readable($this->file) ? file_get_contents($this->file) : '';
     $sections = array_values(array_filter(array_map('trim', preg_split('/^--(TEST|FILE|EXPECTF)--$/m', $raw))));
     if (3 === count($sections)) {
         list($this->name, $this->source, $this->expected) = $sections;
         try {
             $this->out = yay_parse($this->source);
             if (false !== strpos($this->name, '--pretty-print')) {
                 $this->out = yay_pretty($this->out) . PHP_EOL . PHP_EOL . '?>';
             }
         } catch (YayParseError $e) {
             $this->out = $e->getMessage();
             // $this->out = (string) $e;
         } catch (\PhpParser\Error $e) {
             $this->out = 'PHP ' . $e->getMessage();
             // $this->out = (string) $e;
         } catch (Exception $e) {
             $this->out = (string) $e;
         }
         try {
             Assert::assertStringMatchesFormat($this->expected, $this->out);
             $this->status = self::PASSED;
         } catch (Exception $e) {
             $this->status = self::FAILED;
             throw $e;
         }
     } else {
         $this->status = self::BORKED;
     }
 }
コード例 #2
0
ファイル: Functions.php プロジェクト: delkyd/sugarcrm_dev
/**
 * Asserts that a string matches a given format string.
 *
 * @param  string $format
 * @param  string $string
 * @param  string $message
 * @since  Method available since Release 3.5.0
 */
function assertStringMatchesFormat($format, $string, $message = '')
{
    return PHPUnit_Framework_Assert::assertStringMatchesFormat($format, $string, $message);
}
コード例 #3
0
ファイル: OutputBambooTest.php プロジェクト: relue/magento2
 /**
  * Assert that collected data matches expected format
  *
  * @param string $expectedData
  */
 public static function assertCollectedData($expectedData)
 {
     PHPUnit_Framework_Assert::assertStringMatchesFormat($expectedData, self::$_collectedData, 'Expected data went through the stream.');
 }
コード例 #4
0
ファイル: Expect.php プロジェクト: jasonmccreary/expect
 public function toMatchFormat($format)
 {
     if ($this->negate) {
         a::assertStringNotMatchesFormat($format, $this->actual);
     } else {
         a::assertStringMatchesFormat($format, $this->actual);
     }
 }
コード例 #5
0
ファイル: StringMatcher.php プロジェクト: dekeysoft/pu-tester
 public function matchesFormat($format)
 {
     Assert::assertStringMatchesFormat($format, $this->actual, $this->description);
     return $this;
 }
コード例 #6
0
ファイル: Verify.php プロジェクト: jaschweder/Verify
 public function matchesFormat($format)
 {
     a::assertStringMatchesFormat($format, $this->actual, $this->description);
 }
コード例 #7
0
ファイル: Expect.php プロジェクト: jpkleemans/phpunit-expect
 /**
  * Expect that a string matches a given format string.
  *
  * @param string $format
  * @param string $message
  *
  * @return Expect
  */
 public function toMatchFormat($format, $message = '')
 {
     Assert::assertStringMatchesFormat($format, $this->value, $message);
     return $this;
 }