/** * @expectedException Ivory\GoogleMap\Exception\HelperException * @expectedExceptionMessage The place autocomplete bound must have coordinates. */ public function testRenderJavascriptsWithInvalidBound() { $autocomplete = new Autocomplete(); $autocomplete->setBound(1, 2, 3, 4); $autocomplete->getBound()->setSouthWest(null); $autocomplete->getBound()->setNorthEast(null); $this->autocompleteHelper->renderJavascripts($autocomplete); }
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $autocomplete = new Autocomplete(); if ($options['prefix'] !== null) { $autocomplete->setPrefixJavascriptVariable($options['prefix']); } if ($options['bound'] !== null) { if (is_array($options['bound'])) { call_user_func_array(array($autocomplete, 'setBound'), $options['bound']); } else { $autocomplete->setBound($options['bound']); } } if (!empty($options['types'])) { $autocomplete->setTypes($options['types']); } if (!empty($options['component_restrictions'])) { $autocomplete->setComponentRestrictions($options['component_restrictions']); } if ($options['attr']) { foreach ($options['attr'] as $name => $value) { $autocomplete->setInputAttribute($name, $value); } } $autocomplete->setAsync($options['async']); $autocomplete->setLanguage($options['language']); $builder->setAttribute('autocomplete', $autocomplete); }
/** * @expectedException \Ivory\GoogleMap\Exception\PlaceException * @expectedExceptionMessage The bound setter arguments is invalid. * The available prototypes are : * - function setBound(Ivory\GoogleMap\Base\Bound $bound) * - function setBount(Ivory\GoogleMap\Base\Coordinate $southWest, Ivory\GoogleMap\Base\Coordinate $northEast) * - function setBound( * double $southWestLatitude, * double $southWestLongitude, * double $northEastLatitude, * double $northEastLongitude, * boolean southWestNoWrap = true, * boolean $northEastNoWrap = true * ) */ public function testBoundWithInvalidValue() { $this->autocomplete->setBound('foo'); }