Kaynağa Gözat

Fixed failed tests by include new default configs

Dominic Grostate 10 yıl önce
ebeveyn
işleme
2a209d035d

+ 22 - 0
Module/WorkerClass.php

@@ -242,6 +242,17 @@ class WorkerClass
             : $workAnnotation->defaultMethod;
     }
 
+    /**
+     * Load minimumExecutionTime
+     *
+     * If minimumExecutionTime is defined in JobAnnotation, this one is used.
+     * Otherwise is used set in Class
+     *
+     * @param JobAnnotation $jobAnnotation
+     * @param array $defaultSettings
+     *
+     * @return int
+     */
     private function loadMinimumExecutionTime(WorkAnnotation $workAnnotation, array $defaultSettings)
     {
         return is_null($workAnnotation->minimumExecutionTime)
@@ -249,6 +260,17 @@ class WorkerClass
             : (int) $workAnnotation->minimumExecutionTime;
     }
 
+    /**
+     * Load timeout
+     *
+     * If timeout is defined in JobAnnotation, this one is used.
+     * Otherwise is used set in Class
+     *
+     * @param JobAnnotation $jobAnnotation
+     * @param array $defaultSettings
+     *
+     * @return int
+     */
     private function loadTimeout(WorkAnnotation $workAnnotation, array $defaultSettings)
     {
         return is_null($workAnnotation->timeout)

+ 2 - 0
Tests/Module/JobClassTest.php

@@ -71,6 +71,8 @@ class JobClassTest extends PHPUnit_Framework_TestCase
     private $defaultSettings = array(
         'method'                         => 'doHigh',
         'iterations'                     => 100,
+        'minimum_execution_time'         => null,
+        'timeout'                        => null,
         'callbacks'                      => true,
         'jobPrefix'                      => null,
         'generate_unique_key'            => true,

+ 7 - 5
Tests/Module/WorkerClassTest.php

@@ -83,11 +83,13 @@ class WorkerClassTest extends \PHPUnit_Framework_TestCase
      * Default settings
      */
     private $defaultSettings = array(
-        'method'        =>  'doHigh',
-        'iterations'    =>  100,
-        'callbacks'     =>  true,
-        'jobPrefix'     =>  null,
-        'generate_unique_key' => true,
+        'method'                         => 'doHigh',
+        'iterations'                     => 100,
+        'minimum_execution_time'         => null,
+        'timeout'                        => null,
+        'callbacks'                      => true,
+        'jobPrefix'                      => null,
+        'generate_unique_key'            => true,
         'workers_name_prepend_namespace' => true,
     );