Development

Changeset 20854

You must first sign up to be able to contribute.

Changeset 20854

Show
Ignore:
Timestamp:
08/06/09 15:41:31 (4 years ago)
Author:
Kris.Wallsmith
Message:

[1.3] fixed associative array of options passed to sfTask::run() when an optional option is passed as a null value

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.3/lib/task/sfTask.class.php

    r20846 r20854  
    151151      if (is_string($name)) 
    152152      { 
    153         if (false === $value
     153        if (false === $value || is_null($value)
    154154        { 
    155155          unset($options[$name]); 
  • branches/1.3/test/unit/task/sfTaskTest.php

    r20849 r20854  
    1010require_once dirname(__FILE__).'/../../bootstrap/unit.php'; 
    1111 
    12 $t = new lime_test(12); 
     12$t = new lime_test(15); 
    1313 
    1414abstract class BaseTestTask extends sfTask 
     
    5858$t->is_deeply($task->lastArguments, array('foo' => 'FOO', 'bar' => 'BAR'), '->run() accepts a string of arguments'); 
    5959 
     60$task->run(array('foo' => 'FOO', 'bar' => null)); 
     61$t->is_deeply($task->lastArguments, array('foo' => 'FOO', 'bar' => null), '->run() accepts an associative array of arguments when optional arguments are passed as null'); 
     62 
     63$task->run(array('bar' => null, 'foo' => 'FOO')); 
     64$t->is_deeply($task->lastArguments, array('foo' => 'FOO', 'bar' => null), '->run() accepts an unordered associative array of arguments when optional arguments are passed as null'); 
     65 
    6066class ArgumentsTest2Task extends BaseTestTask 
    6167{ 
     
    101107$t->is_deeply($task->lastOptions, array('none' => false, 'required' => 'TEST1', 'optional' => null, 'array' => array('one', 'two', 'three')), '->run() accepts an associative array of option values'); 
    102108 
     109$task->run(array(), array('optional' => null)); 
     110$t->is_deeply($task->lastOptions, array('none' => false, 'required' => null, 'optional' => null, 'array' => array()), '->run() accepts an associative array of options when optional values are passed as null'); 
     111 
    103112$task->run('--none --required=TEST1 --array=one --array=two --array=three'); 
    104113$t->is_deeply($task->lastOptions, array('none' => true, 'required' => 'TEST1', 'optional' => null, 'array' => array('one', 'two', 'three')), '->run() accepts a string of options');