Пример #1
0
 public function testParameters()
 {
     $b = new Behavior();
     $this->assertEquals($b->getParameters(), array(), 'Behavior parameters is an empty array by default');
     $b->addParameter(array('name' => 'foo', 'value' => 'bar'));
     $this->assertEquals($b->getParameters(), array('foo' => 'bar'), 'addParameter() sets a parameter from an associative array');
     $b->addParameter(array('name' => 'foo2', 'value' => 'bar2'));
     $this->assertEquals($b->getParameters(), array('foo' => 'bar', 'foo2' => 'bar2'), 'addParameter() adds a parameter from an associative array');
     $b->addParameter(array('name' => 'foo', 'value' => 'bar3'));
     $this->assertEquals($b->getParameters(), array('foo' => 'bar3', 'foo2' => 'bar2'), 'addParameter() changes a parameter from an associative array');
     $this->assertEquals($b->getParameter('foo'), 'bar3', 'getParameter() retrieves a parameter value by name');
     $b->setParameters(array('foo3' => 'bar3', 'foo4' => 'bar4'));
     $this->assertEquals($b->getParameters(), array('foo3' => 'bar3', 'foo4' => 'bar4'), 'setParameters() changes the whole parameter array');
 }
 /**
  * {@inheritdoc}
  */
 public function addParameter($attribute)
 {
     if ('scope_column' === $attribute['name']) {
         $this->parameters['scope_column'] .= ($this->parameters['scope_column'] ? ',' : '') . $attribute['value'];
     } else {
         parent::addParameter($attribute);
     }
 }