Author: Derick Rethans
Date: 2006-01-12 17:36:03 +0100 (Thu, 12 Jan 2006)
New Revision: 1796

Log:
- Use new Base exceptions.

Modified:
   packages/Configuration/trunk/src/file_reader.php
   packages/Configuration/trunk/src/file_writer.php
   packages/Configuration/trunk/tests/configuration_array_writer_test.php
   packages/Configuration/trunk/tests/configuration_ini_reader_test.php
   packages/Configuration/trunk/tests/configuration_ini_writer_test.php

Modified: packages/Configuration/trunk/src/file_reader.php
===================================================================
--- packages/Configuration/trunk/src/file_reader.php    2006-01-12 16:23:22 UTC 
(rev 1795)
+++ packages/Configuration/trunk/src/file_reader.php    2006-01-12 16:36:03 UTC 
(rev 1796)
@@ -128,14 +128,14 @@
             switch ( $name )
             {
                 case 'useComments':
-                    if ( gettype( $value) != 'boolean' )
+                    if ( gettype( $value ) != 'boolean' )
                     {
-                        throw new ezcBaseConfigException( $name, 
ezcBaseConfigException::VALUE_OUT_OF_RANGE, $value );
+                        throw new ezcBaseSettingValueException( $name, $value, 
'boolean' );
                     }
                     $this->useComments = $value;
                     break;
                 default:
-                    throw new ezcBaseConfigException( $name, 
ezcBaseConfigException::UNKNOWN_CONFIG_SETTING );
+                    throw new ezcBaseSettingNotFoundException( $name );
             }
         }
     }

Modified: packages/Configuration/trunk/src/file_writer.php
===================================================================
--- packages/Configuration/trunk/src/file_writer.php    2006-01-12 16:23:22 UTC 
(rev 1795)
+++ packages/Configuration/trunk/src/file_writer.php    2006-01-12 16:36:03 UTC 
(rev 1796)
@@ -303,23 +303,23 @@
                 case 'useComments':
                     if ( gettype( $value ) != 'boolean' )
                     {
-                        throw new ezcBaseConfigException( $name, 
ezcBaseConfigException::VALUE_OUT_OF_RANGE, $value );
+                        throw new ezcBaseSettingValueException( $name, $value, 
'boolean' );
                     }
                     $this->useComments = $value;
                     break;
                 case 'permissions':
                     if ( gettype( $value ) != 'integer' )
                     {
-                        throw new ezcBaseConfigException( $name, 
ezcBaseConfigException::VALUE_OUT_OF_RANGE, $value );
+                        throw new ezcBaseSettingValueException( $name, $value, 
'integer, 0 - 0777' );
                     }
                     if ( $value < 0 || $value > 0777 )
                     {
-                        throw new ezcBaseConfigException( $name, 
ezcBaseConfigException::VALUE_OUT_OF_RANGE, $value );
+                        throw new ezcBaseSettingValueException( $name, $value, 
'integer, 0 - 0777' );
                     }
                     $this->permissions = $value;
                     break;
                 default:
-                    throw new ezcBaseConfigException( $name, 
ezcBaseConfigException::UNKNOWN_CONFIG_SETTING );
+                    throw new ezcBaseSettingNotFoundException( $name );
             }
         }
     }

Modified: packages/Configuration/trunk/tests/configuration_array_writer_test.php
===================================================================
--- packages/Configuration/trunk/tests/configuration_array_writer_test.php      
2006-01-12 16:23:22 UTC (rev 1795)
+++ packages/Configuration/trunk/tests/configuration_array_writer_test.php      
2006-01-12 16:36:03 UTC (rev 1796)
@@ -41,9 +41,9 @@
             $backend->setOptions( array ( 'useComments' => 
'tests/translations' ) );
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingValueException $e )
         {
-            self::assertEquals( ezcBaseConfigException::VALUE_OUT_OF_RANGE, 
$e->getCode() );
+            self::assertEquals( "The value <tests/translations> that you were 
trying to assign to setting <useComments> is invalid. Allowed values are: 
boolean", $e->getMessage() );
         }
     }
 
@@ -61,10 +61,9 @@
             $backend->setOptions( array ( 'permissions' => 
'tests/translations' ) );
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingValueException $e )
         {
-            self::assertEquals( ezcBaseConfigException::VALUE_OUT_OF_RANGE, 
$e->getCode() );
-            self::assertEquals( "The value <tests/translations> that you were 
trying to assign to setting <permissions> is invalid.", $e->getMessage() );
+            self::assertEquals( "The value <tests/translations> that you were 
trying to assign to setting <permissions> is invalid. Allowed values are: 
integer, 0 - 0777", $e->getMessage() );
         }
     }
 
@@ -76,10 +75,9 @@
             $backend->setOptions( array ( 'permissions' => -1 ) );
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingValueException $e )
         {
-            self::assertEquals( ezcBaseConfigException::VALUE_OUT_OF_RANGE, 
$e->getCode() );
-            self::assertEquals( "The value <-1> that you were trying to assign 
to setting <permissions> is invalid.", $e->getMessage() );
+            self::assertEquals( "The value <-1> that you were trying to assign 
to setting <permissions> is invalid. Allowed values are: integer, 0 - 0777", 
$e->getMessage() );
         }
     }
 
@@ -91,10 +89,9 @@
             $backend->setOptions( array ( 'permissions' => 01000 ) );
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingValueException $e )
         {
-            self::assertEquals( ezcBaseConfigException::VALUE_OUT_OF_RANGE, 
$e->getCode() );
-            self::assertEquals( "The value <512> that you were trying to 
assign to setting <permissions> is invalid.", $e->getMessage() );
+            self::assertEquals( "The value <512> that you were trying to 
assign to setting <permissions> is invalid. Allowed values are: integer, 0 - 
0777", $e->getMessage() );
         }
     }
 
@@ -113,9 +110,9 @@
             $backend->setOptions( array ( 'lOcAtIOn' => 'tests/translations' ) 
);
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingNotFoundException $e )
         {
-            self::assertEquals( 
ezcBaseConfigException::UNKNOWN_CONFIG_SETTING, $e->getCode() );
+            self::assertEquals( "The setting <lOcAtIOn> is not a valid 
configuration setting.", $e->getMessage() );
         }
     }
 

Modified: packages/Configuration/trunk/tests/configuration_ini_reader_test.php
===================================================================
--- packages/Configuration/trunk/tests/configuration_ini_reader_test.php        
2006-01-12 16:23:22 UTC (rev 1795)
+++ packages/Configuration/trunk/tests/configuration_ini_reader_test.php        
2006-01-12 16:36:03 UTC (rev 1796)
@@ -29,9 +29,9 @@
             $backend->setOptions( array ( 'useComments' => 
'tests/translations' ) );
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingValueException $e )
         {
-            self::assertEquals( ezcBaseConfigException::VALUE_OUT_OF_RANGE, 
$e->getCode() );
+            self::assertEquals( "The value <tests/translations> that you were 
trying to assign to setting <useComments> is invalid. Allowed values are: 
boolean", $e->getMessage() );
         }
     }
 
@@ -50,9 +50,9 @@
             $backend->setOptions( array ( 'lOcAtIOn' => 'tests/translations' ) 
);
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingNotFoundException $e )
         {
-            self::assertEquals( 
ezcBaseConfigException::UNKNOWN_CONFIG_SETTING, $e->getCode() );
+            self::assertEquals( "The setting <lOcAtIOn> is not a valid 
configuration setting.", $e->getMessage() );
         }
     }
 

Modified: packages/Configuration/trunk/tests/configuration_ini_writer_test.php
===================================================================
--- packages/Configuration/trunk/tests/configuration_ini_writer_test.php        
2006-01-12 16:23:22 UTC (rev 1795)
+++ packages/Configuration/trunk/tests/configuration_ini_writer_test.php        
2006-01-12 16:36:03 UTC (rev 1796)
@@ -41,9 +41,9 @@
             $backend->setOptions( array ( 'useComments' => 
'tests/translations' ) );
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingValueException $e )
         {
-            self::assertEquals( ezcBaseConfigException::VALUE_OUT_OF_RANGE, 
$e->getCode() );
+            self::assertEquals( "The value <tests/translations> that you were 
trying to assign to setting <useComments> is invalid. Allowed values are: 
boolean", $e->getMessage() );
         }
     }
 
@@ -61,10 +61,9 @@
             $backend->setOptions( array ( 'permissions' => 
'tests/translations' ) );
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingValueException $e )
         {
-            self::assertEquals( ezcBaseConfigException::VALUE_OUT_OF_RANGE, 
$e->getCode() );
-            self::assertEquals( "The value <tests/translations> that you were 
trying to assign to setting <permissions> is invalid.", $e->getMessage() );
+            self::assertEquals( "The value <tests/translations> that you were 
trying to assign to setting <permissions> is invalid. Allowed values are: 
integer, 0 - 0777", $e->getMessage() );
         }
     }
 
@@ -76,10 +75,9 @@
             $backend->setOptions( array ( 'permissions' => -1 ) );
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingValueException $e )
         {
-            self::assertEquals( ezcBaseConfigException::VALUE_OUT_OF_RANGE, 
$e->getCode() );
-            self::assertEquals( "The value <-1> that you were trying to assign 
to setting <permissions> is invalid.", $e->getMessage() );
+            self::assertEquals( "The value <-1> that you were trying to assign 
to setting <permissions> is invalid. Allowed values are: integer, 0 - 0777", 
$e->getMessage() );
         }
     }
 
@@ -91,10 +89,9 @@
             $backend->setOptions( array ( 'permissions' => 01000 ) );
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingValueException $e )
         {
-            self::assertEquals( ezcBaseConfigException::VALUE_OUT_OF_RANGE, 
$e->getCode() );
-            self::assertEquals( "The value <512> that you were trying to 
assign to setting <permissions> is invalid.", $e->getMessage() );
+            self::assertEquals( "The value <512> that you were trying to 
assign to setting <permissions> is invalid. Allowed values are: integer, 0 - 
0777", $e->getMessage() );
         }
     }
 
@@ -113,9 +110,9 @@
             $backend->setOptions( array ( 'lOcAtIOn' => 'tests/translations' ) 
);
             $this->fail( 'Expected exception was not thrown' );
         }
-        catch ( ezcBaseConfigException $e )
+        catch ( ezcBaseSettingNotFoundException $e )
         {
-            self::assertEquals( 
ezcBaseConfigException::UNKNOWN_CONFIG_SETTING, $e->getCode() );
+            self::assertEquals( "The setting <lOcAtIOn> is not a valid 
configuration setting.", $e->getMessage() );
         }
     }
 

-- 
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components

Reply via email to