Esempio n. 1
0
 /**
  * Add a parameter to the command
  *
  * @param ApiParam $param Parameter to add
  *
  * @return self
  */
 public function addParam(ApiParam $param)
 {
     $this->params[$param->getName()] = $param;
     return $this;
 }
Esempio n. 2
0
 public function testCanBuildUpParams()
 {
     $p = new ApiParam(array());
     $p->setName('foo')->setAppend('a')->setDefault('b')->setDoc('c')->setFilters(array('d'))->setLocation('e')->setLocationKey('f')->setMaxLength(2)->setMinLength(1)->setPrepend('g')->setRequired(true)->setStatic('h')->setType('i')->setTypeArgs(array('j'));
     $p->addFilter('foo');
     $this->assertEquals('foo', $p->getName());
     $this->assertEquals('a', $p->getAppend());
     $this->assertEquals('b', $p->getDefault());
     $this->assertEquals('c', $p->getDoc());
     $this->assertEquals(array('d', 'foo'), $p->getFilters());
     $this->assertEquals('e', $p->getLocation());
     $this->assertEquals('f', $p->getLocationKey());
     $this->assertEquals(2, $p->getMaxLength());
     $this->assertEquals(1, $p->getMinLength());
     $this->assertEquals('g', $p->getPrepend());
     $this->assertEquals(true, $p->getRequired());
     $this->assertEquals('h', $p->getStatic());
     $this->assertEquals('i', $p->getType());
     $this->assertEquals(array('j'), $p->getTypeArgs());
 }
 public function testUsesArrayByDefaultForFilters()
 {
     $d = $this->data;
     $d['filters'] = null;
     $p = new ApiParam($d);
     $this->assertEquals(array(), $p->getFilters());
 }
Esempio n. 4
0
 public function testAllowsDotNotationForFiltersClasses()
 {
     $p = new ApiParam(array('filters' => 'Mesa.JarJar::binks,Yousa.NoJarJar::binks,Foo\\Baz::bar'));
     $this->assertEquals(array('Mesa\\JarJar::binks', 'Yousa\\NoJarJar::binks', 'Foo\\Baz::bar'), $p->getFilters());
 }