From 7f40d0c573aa0a5733249f2ea2eb96338a63ed48 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 6 Jun 2014 12:09:59 +0800 Subject: [PATCH] Pass through the phpunit --filter option. Fixes 84 --- extra/bash_completion | 2 +- lib/commands/phpunit.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/extra/bash_completion b/extra/bash_completion index 49312f0..9a005d8 100644 --- a/extra/bash_completion +++ b/extra/bash_completion @@ -169,7 +169,7 @@ function _mdk() { OPTS="$(compgen -A file $CUR)" compopt -o nospace else - OPTS="--force --run --testcase --unittest" + OPTS="--force --run --testcase --unittest --filter" OPTS="$OPTS $(_list_instances)" fi ;; diff --git a/lib/commands/phpunit.py b/lib/commands/phpunit.py index aaf25a8..ffd4aca 100644 --- a/lib/commands/phpunit.py +++ b/lib/commands/phpunit.py @@ -64,6 +64,14 @@ class PhpunitCommand(Command): } ), ( + ['--filter'], + { + 'default': None, + 'help': 'Filter to pass through to PHPUnit. This sets --run.', + 'metavar': 'filter' + } + ), + ( ['name'], { 'default': None, @@ -116,7 +124,7 @@ class PhpunitCommand(Command): M.initPHPUnit(force=args.force) logging.info('PHPUnit ready!') - if args.unittest or args.testcase: + if args.unittest or args.testcase or args.filter: args.run = True if args.run: @@ -129,6 +137,8 @@ class PhpunitCommand(Command): cmd.append(args.testcase) elif args.unittest: cmd.append(args.unittest) + elif args.filter: + cmd.append('--filter="%s"' % args.filter) cmd = ' '.join(cmd) process(cmd, M.get('path'), None, None) except Exception as e: -- 2.11.0