コード例 #1
0
ファイル: ApiCommand.php プロジェクト: jsnshrmn/Suma
 /**
  * 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;
 }
コード例 #2
0
ファイル: ApiParamTest.php プロジェクト: jsnshrmn/Suma
 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());
 }
コード例 #3
0
 public function testUsesArrayByDefaultForFilters()
 {
     $d = $this->data;
     $d['filters'] = null;
     $p = new ApiParam($d);
     $this->assertEquals(array(), $p->getFilters());
 }
コード例 #4
0
ファイル: ApiParamTest.php プロジェクト: nickpeirson/guzzle
 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());
 }