Browse Source

Working on removing the dependency from Core in Utility

Jose Lorenzo Rodriguez 11 years ago
parent
commit
651f396b12
3 changed files with 5 additions and 6 deletions
  1. 3 3
      src/Utility/String.php
  2. 1 2
      src/Utility/Xml.php
  3. 1 1
      tests/TestCase/Utility/StringTest.php

+ 3 - 3
src/Utility/String.php

@@ -14,7 +14,7 @@
  */
 namespace Cake\Utility;
 
-use Cake\Core\Exception\Exception;
+use InvalidArgumentException;
 
 /**
  * String handling methods.
@@ -722,7 +722,7 @@ class String {
  * @param string $size Size in human readable string like '5MB', '5M', '500B', '50kb' etc.
  * @param mixed $default Value to be returned when invalid size was used, for example 'Unknown type'
  * @return mixed Number of bytes as integer on success, `$default` on failure if not false
- * @throws \Cake\Core\Exception\Exception On invalid Unit type.
+ * @throws \InvalidArgumentException On invalid Unit type.
  * @link http://book.cakephp.org/3.0/en/core-libraries/helpers/text.html
  */
 	public static function parseFileSize($size, $default = false) {
@@ -750,7 +750,7 @@ class String {
 		if ($default !== false) {
 			return $default;
 		}
-		throw new Exception('No unit type.');
+		throw new InvalidArgumentException('No unit type.');
 	}
 
 

+ 1 - 2
src/Utility/Xml.php

@@ -14,7 +14,6 @@
  */
 namespace Cake\Utility;
 
-use Cake\Core\Configure;
 use Cake\Utility\Exception\XmlException;
 use \DOMDocument;
 
@@ -197,7 +196,7 @@ class Xml {
 		$defaults = array(
 			'format' => 'tags',
 			'version' => '1.0',
-			'encoding' => Configure::read('App.encoding'),
+			'encoding' => mb_internal_encoding(),
 			'return' => 'simplexml',
 			'pretty' => false
 		);

+ 1 - 1
tests/TestCase/Utility/StringTest.php

@@ -1427,7 +1427,7 @@ podeís adquirirla.</span></p>
 /**
  * testFromReadableSize
  *
- * @expectedException \Cake\Core\Exception\Exception
+ * @expectedException InvalidArgumentException
  * @return void
  */
 	public function testparseFileSizeException() {