Req #15928 [Opn]: Add 'skip all tests except' option to phpdt
| From: | sofiacardita at gmail dot com | Date: | Sun, 22 Feb 2009 20:29:35 +0000 |
| Subject: | Req #15928 [Opn]: Add 'skip all tests except' option to phpdt | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-64@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=15928&edit=1
ID: 15928
Updated by: sofiacardita@gmail.com
Reported By: sofiacardita at gmail dot com
Summary: Add 'skip all tests except' option to phpdt
Status: Open
Type: Feature/Change Request
Package: Testing_DocTest
Operating System: mac
PHP Version: 5.2.5
Roadmap Versions:
New Comment:
Just noticed that the line
$reg = Testing_DocTest_Registry::singleton();
in the method parse of doctest/parser/default.php should not be inside
the foreach loops but just before them, around line 177 so that we have
[..]
$reg = Testing_DocTest_Registry::singleton();
foreach ($files as $file) {
[..]
and later we have
[..]
//skip all tests except option
if ($reg->skipallexcept && $reg->skipallexcept !=
trim($this->_testCase-
>altname)) {
$this->_testCase->flags |= constant('Testing_DocTest::FLAG_SKIP');
}
[..]
Previous Comments:
------------------------------------------------------------------------
[2009-02-22 20:17:35] sofia
Description:
------------
Say I have a class that has several doctests in it and I'm
currently
only working on one of the class methods. I would like a way to run
only
the test specified instead of all the tests in the class. That way I
don't
have to wait for all the tests to run to see the output of the method
I'm
currently testing. I've implemented a way to do this which is in the
test
script section. It would be used like this:
phpdt -s "doctest name" file.php
I was unsure about the name, it could also be runonly but since there
was already a skip if flag it seemed more in tune with the project but
feel
free to change as you see fit.
Test script:
---------------
FILE: phpdt (around line 75)
$parser->addOption('skipallexcept', array(
'short_name' => '-s',
'long_name' => '--skipallexcept',
'description' => 'Skip all tests except ?.',
'action' => 'StoreString'
));
FILE: doctest/parser/default.php->parse() (around line 235)
//skip all tests except option
$reg = Testing_DocTest_Registry::singleton();
if ($reg->skipallexcept && $reg->skipallexcept !=
trim($this->_testCase->altname)) {
$this->_testCase->flags |=
constant('Testing_DocTest::FLAG_SKIP');
}
// end skip all tests except option
(after the 'trim last eol' and before the 'reset state' code)
Expected result:
----------------
Actual result:
--------------
------------------------------------------------------------------------
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=15928&edit=1