Browse Source

Remove proxy for money temporarily.

Remove this proxy until we have a better money() validation method. The
current one is not very locale aware and isn't great at handling
a variety of currencies. We can re-implement the money() proxy when we
have a better validation method to use.
Mark Story 10 years ago
parent
commit
1f394c1fa5
2 changed files with 0 additions and 31 deletions
  1. 0 19
      src/Validation/Validator.php
  2. 0 12
      tests/TestCase/Validation/ValidatorTest.php

+ 0 - 19
src/Validation/Validator.php

@@ -1298,25 +1298,6 @@ class Validator implements ArrayAccess, IteratorAggregate, Countable
     }
 
     /**
-     * Add a validation rule to ensure a field is a money value.
-     *
-     * @param string $field The field you want to apply the rule to.
-     * @param string $symbolPosition The position of the currency symbol
-     * @param string|null $message The error message when the rule fails.
-     * @param string|callable|null $when Either 'create' or 'update' or a callable that returns
-     *   true when the validation rule should be applied.
-     * @see \Cake\Validation\Validation::money()
-     * @return $this
-     */
-    public function money($field, $symbolPosition = 'left', $message = null, $when = null)
-    {
-        $extra = array_filter(['on' => $when, 'message' => $message]);
-        return $this->add($field, 'money', $extra + [
-            'rule' => ['money', $symbolPosition]
-        ]);
-    }
-
-    /**
      * Add a validation rule for a multiple select. Comparison is case sensitive by default.
      *
      * @param string $field The field you want to apply the rule to.

+ 0 - 12
tests/TestCase/Validation/ValidatorTest.php

@@ -1528,18 +1528,6 @@ class ValidatorTest extends TestCase
     }
 
     /**
-     * Tests the money proxy method
-     *
-     * @return void
-     */
-    public function testMoney()
-    {
-        $validator = new Validator();
-        $this->assertProxyMethod($validator, 'money', 'left', ['left']);
-        $this->assertNotEmpty($validator->errors(['username' => 'not money']));
-    }
-
-    /**
      * Tests the multiple proxy method
      *
      * @return void