Fixed minor issues with Behat on built-in server
authorFrederic Massart <fred@moodle.com>
Thu, 21 Feb 2013 10:26:09 +0000 (18:26 +0800)
committerFrederic Massart <fred@moodle.com>
Thu, 21 Feb 2013 10:26:09 +0000 (18:26 +0800)
lib/moodle.py
moodle-behat.py

index 897ab00..8b28a77 100644 (file)
@@ -266,10 +266,11 @@ class Moodle(object):
         self.updateConfig('behat_prefix', behat_prefix)
 
         # Switch completely?
-        self.updateConfig('behat_switchcompletely', switchcompletely)
         if switchcompletely:
+            self.updateConfig('behat_switchcompletely', switchcompletely)
             self.updateConfig('behat_wwwroot', self.get('wwwroot'))
         else:
+            self.removeConfig('behat_switchcompletely')
             self.removeConfig('behat_wwwroot')
 
         # Drop the tables
index 58819fa..eb05df2 100755 (executable)
@@ -109,7 +109,9 @@ try:
         phpServer = None
         if not M.get('behat_switchcompletely'):
             debug('Starting standalone PHP server')
-            phpServer = ProcessInThread(phpCommand)
+            kwargs = {}
+            kwargs['cwd'] = M.get('path')
+            phpServer = ProcessInThread(phpCommand, **kwargs)
             phpServer.start()
 
         # Launching Selenium
@@ -140,7 +142,7 @@ try:
 
         # Remove the switch completely tag
         if M.get('behat_switchcompletely'):
-            M.updateConfig('behat_switchcompletely', False)
+            M.removeConfig('behat_switchcompletely')
 
     else:
         debug('Launch PHP Server (or set $CFG->behat_switchcompletely to True):\n %s' % (phpCommand))