Skip to content

Commit

Permalink
Fix tests for RC1.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Jan 11, 2015
1 parent 9529417 commit afe0d96
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Geocode/Geocode.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Geo\Geocode;

use Cake\Utility\String;
use Cake\Utility\Text;
use Cake\Core\Configure;
use Cake\Network\Http\Client;
use Cake\Log\Log;
Expand Down Expand Up @@ -184,7 +184,7 @@ protected function _url() {
$params = array(
'host' => $this->options['host']
);
$url = String::insert(static::BASE_URL, $params, array('before' => '{', 'after' => '}', 'clean' => true));
$url = Text::insert(static::BASE_URL, $params, array('before' => '{', 'after' => '}', 'clean' => true));
return $url;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Model/Behavior/GeocoderBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class GeocoderBehavior extends Behavior {
'require' => false, 'allowEmpty' => true, 'invalidate' => array(), 'expect' => array(),
'lat' => 'lat', 'lng' => 'lng', 'formatted_address' => 'formatted_address',
'host' => null, 'language' => 'de', 'region' => '', 'bounds' => '',
'overwrite' => false, 'update' => array(), 'before' => 'save',
'overwrite' => false, 'update' => array(), 'on' => 'beforeSave',
'min_accuracy' => Geocode::ACC_COUNTRY, 'allow_inconclusive' => true, 'unit' => Geocode::UNIT_KM,
'log' => true, // log successfull results to geocode.log (errors will be logged to error.log in either case)
'implementedFinders' => [
Expand Down Expand Up @@ -84,8 +84,8 @@ public function __construct(Table $table, array $config = []) {
* @param \ArrayObject $options the options passed to the save method
* @return void
*/
public function beforeValidate(Event $event, Entity $entity, ArrayObject $options) {
if ($this->_config['before'] === 'validate') {
public function beforeRules(Event $event, Entity $entity, ArrayObject $options) {
if ($this->_config['on'] === 'beforeRules') {
if(!$this->geocode($entity)) {
$event->stopPropagation();
}
Expand All @@ -99,7 +99,7 @@ public function beforeValidate(Event $event, Entity $entity, ArrayObject $option
* @return void
*/
public function beforeSave(Event $event, Entity $entity, ArrayObject $options) {
if ($this->_config['before'] === 'save') {
if ($this->_config['on'] === 'beforeSave') {
if (!$this->geocode($entity)) {
$event->stopPropagation();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Geocode/GeocodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ public function testBlur() {
foreach ($coords as $coord) {
$is = $this->Geocode->blur($coord[0], $coord[1]);
//pr('is: '.$is.' - expected: '.$coord[0].' +- '.$coord[2]);
$this->assertWithinMargin($is, $coord[0], $coord[2]);
$this->assertNotWithinMargin($is, $coord[0], $coord[2] / 4);
$this->assertWithinRange($is, $coord[0], $coord[2]);
$this->assertNotWithinRange($is, $coord[0], $coord[2] / 4);
}
}

Expand Down

0 comments on commit afe0d96

Please sign in to comment.