Skip to content

Commit e4c9420

Browse files
committed
created TestCase base class
updated readme
1 parent d7bbb28 commit e4c9420

4 files changed

Lines changed: 20 additions & 12 deletions

File tree

README.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ As a result, unless a bug is present only in the PHP version, pull requests
1111
are unlikely to be accepted unless they are themselves direct transliterations
1212
of bugfixes in the Python version.
1313

14-
New in version 0.6.1:
14+
New in version 0.7.0:
1515

1616
- API has changed slightly. ``Docopt\docopt`` has been renamed to ``Docopt::handle``
1717
to fix autoloader support. See issue #3.
1818

1919
- Compatibility with Python master branch at commit `d5b96f878a
2020
<https://github.com/docopt/docopt/commit/d5b96f878abbda51b62f1e28010d2b42b19a27dc>`_
2121

22-
- Potentially serious BC break in `issue 102 <https://github.com/docopt/docopt/issues/102>`_
22+
- Significant BC break. Existing users should read the information below about Usage and
23+
Option sections. See `issue 102 <https://github.com/docopt/docopt/issues/102>`_ for more
24+
info.
2325

2426
Please see the `Python version's README <https://github.com/docopt/docopt/blob/master/README.rst>`_
2527
for any new and breaking changes that are not specific to the PHP version.
@@ -85,7 +87,7 @@ Create a ``composer.json`` file for your project
8587
8688
{
8789
"require": {
88-
"docopt/docopt": ">=0.6.*"
90+
"docopt/docopt": ">=0.7.*"
8991
}
9092
}
9193

test/lib/PythonPortedTest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Docopt\Response;
1212
use Docopt\Command;
1313

14-
class PythonPortedTest extends \PHPUnit_Framework_TestCase
14+
class PythonPortedTest extends TestCase
1515
{
1616
/**
1717
* The arguments from the docopt test file are the other way around.
@@ -858,13 +858,6 @@ public function testIssue71DoubleDashIsNotAValidOptionArgument()
858858
$result = $this->docopt("usage: prog [-l LEVEL] [--] <args>...\noptions: -l LEVEL", "-l -- 1 2");
859859
$this->assertFalse($result->success);
860860
}
861-
862-
private function docopt($usage, $args='', $extra=array())
863-
{
864-
$extra = array_merge(array('exit'=>false, 'help'=>false), $extra);
865-
$handler = new \Docopt\Handler($extra);
866-
return call_user_func(array($handler, 'handle'), $usage, $args);
867-
}
868861

869862
public function testParseSection()
870863
{

test/lib/TestCase.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
namespace Docopt\Test;
3+
4+
abstract class TestCase extends \PHPUnit_Framework_TestCase
5+
{
6+
protected function docopt($usage, $args='', $extra=array())
7+
{
8+
$extra = array_merge(array('exit'=>false, 'help'=>false), $extra);
9+
$handler = new \Docopt\Handler($extra);
10+
return call_user_func(array($handler, 'handle'), $usage, $args);
11+
}
12+
}

test/run.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
require $basePath.'/src/docopt.php';
55
require_once 'PHPUnit/Autoload.php';
66

7-
require $testPath.'/lib/PythonPortedTest.php';
7+
require $testPath.'/lib/TestCase.php';
88
require $testPath.'/lib/LanguageAgnosticTest.php';
9+
require $testPath.'/lib/PythonPortedTest.php';
910

1011
$options = array(
1112
'filter'=>null,

0 commit comments

Comments
 (0)