Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6820189
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:23:44+00:00 2026-05-26T21:23:44+00:00

I’m trying to write a test for a PHPUnit extiontion I’m working on which

  • 0

I’m trying to write a test for a PHPUnit extiontion I’m working on which needs a regex matcher in the expected section of the test.

The documentations of PHPT file states that there is a %r flag which can be used to match regex in the --EXPECTF-- section of the test. You can get more details from: PHPT – Test File Layout

I tried to use it in my tests, but it always fail! So I decided to write a simple test to check the problem and the test looked like this:

--TEST--
Test the %r tag of EXPECTF in phpt
--FILE--
<?php

echo '1';

?>
--EXPECTF--
%r.%r

This test fails when I run it using pear’s run-tests command. The .diff file contains the following:

001- %r.%r
001+ 1

It seems as if this tag doesn’t get recognized by the tests runner. So I tried to find an example which uses this tag in the tests of the source of PHP. There was only one test to be found using it (inside: php-src-5.3/ext/standard/tests/network/gethostbyaddr_basic1.phpt).

I’m not sure what I’m doing wrong here… Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:23:45+00:00Added an answer on May 26, 2026 at 9:23 pm

    It only works with the run-tests.php that comes with the PHP source distribution (in its root), not with PEAR’s version.

    PHPRC=. TEST_PHP_EXECUTABLE=./sapi/cli/php php run-tests.php a.phpt
    PASS Test the %r tag of EXPECTF in phpt [a.phpt]
    

    If you take a look at PEAR’s version in <PHP prefix>/lib/php/PEAR/RunTest.php around line 520, you’ll notice it doesn’t support %r.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.