Pass through the phpunit --filter option. Fixes 84
authorAndrew Nicols <andrew@nicols.co.uk>
Fri, 6 Jun 2014 04:09:59 +0000 (12:09 +0800)
committerFrederic Massart <fred@moodle.com>
Mon, 21 Jul 2014 02:27:32 +0000 (10:27 +0800)
extra/bash_completion
lib/commands/phpunit.py

index 49312f0..9a005d8 100644 (file)
@@ -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
                 ;;
index aaf25a8..ffd4aca 100644 (file)
@@ -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: