Author: Derick Rethans
Date: 2006-01-13 15:01:01 +0100 (Fri, 13 Jan 2006)
New Revision: 1830
Log:
- Fixed type names in exceptoin messages.
- Replaced ConfigurationFileException by BaseFileNotFoundException.
Removed:
packages/Configuration/trunk/src/exceptions/file_exception.php
Modified:
packages/Base/trunk/tests/base_test.php
packages/Configuration/trunk/src/configuration_autoload.php
packages/Configuration/trunk/src/file_reader.php
packages/Configuration/trunk/src/file_writer.php
packages/Configuration/trunk/src/ini/ini_parser.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/Base/trunk/tests/base_test.php
===================================================================
--- packages/Base/trunk/tests/base_test.php 2006-01-13 13:36:40 UTC (rev
1829)
+++ packages/Base/trunk/tests/base_test.php 2006-01-13 14:01:01 UTC (rev
1830)
@@ -40,11 +40,11 @@
{
try
{
- throw new ezcBaseSettingValueException( 'broken', 42, "40 to 48" );
+ throw new ezcBaseSettingValueException( 'broken', 42, "int, 40 -
48" );
}
catch ( ezcBaseSettingValueException $e )
{
- $this->assertEquals( "The value <42> that you were trying to
assign to setting <broken> is invalid. Allowed values are: 40 to 48",
$e->getMessage() );
+ $this->assertEquals( "The value <42> that you were trying to
assign to setting <broken> is invalid. Allowed values are: int, 40 - 48",
$e->getMessage() );
}
}
Modified: packages/Configuration/trunk/src/configuration_autoload.php
===================================================================
--- packages/Configuration/trunk/src/configuration_autoload.php 2006-01-13
13:36:40 UTC (rev 1829)
+++ packages/Configuration/trunk/src/configuration_autoload.php 2006-01-13
14:01:01 UTC (rev 1830)
@@ -24,7 +24,6 @@
'ezcConfigurationWriter' =>
'Configuration/interfaces/writer.php',
'ezcConfigurationException' =>
'Configuration/exceptions/exception.php',
- 'ezcConfigurationFileException' =>
'Configuration/exceptions/file_exception.php',
'ezcConfigurationGroupExistsAlreadyException' =>
'Configuration/exceptions/group_exists_already.php',
'ezcConfigurationInvalidReaderClassException' =>
'Configuration/exceptions/invalid_reader_class.php',
'ezcConfigurationInvalidSuffixException' =>
'Configuration/exceptions/invalid_suffix.php',
Deleted: packages/Configuration/trunk/src/exceptions/file_exception.php
===================================================================
--- packages/Configuration/trunk/src/exceptions/file_exception.php
2006-01-13 13:36:40 UTC (rev 1829)
+++ packages/Configuration/trunk/src/exceptions/file_exception.php
2006-01-13 14:01:01 UTC (rev 1830)
@@ -1,68 +0,0 @@
-<?php
-/**
- * File containing the ezcConfigurationFileException class
- *
- * @package Configuration
- * @version //autogen//
- * @copyright Copyright (C) 2005, 2006 eZ systems as. All rights reserved.
- * @license http://ez.no/licenses/new_bsd New BSD License
- */
-/**
- * This class provides an exception for errors occuring while accessing file
- * based configurations.
- *
- * Create the exception and pass the error code in the constructor, the error
- * message will be automatically created.
- * <code>
- * throw new ezcConfigurationFileException( ezcConfigurationFileException::
- * FILE_NOT_READABLE, $filename );
- * </code>
- *
- * @package Configuration
- * @version //autogen//
- */
-class ezcConfigurationFileException extends Exception
-{
- /**
- * The configuration file could not be found on the filesystem.
- */
- const FILE_NOT_FOUND = 1;
-
- /**
- * The configuration file could not be read from the filesystem.
- */
- const FILE_NOT_READABLE = 2;
-
- /**
- * The configuration file could not be written to the filesystem.
- */
- const FILE_NOT_WRITABLE = 3;
-
- /**
- * Constructs a file exception.
- *
- * Creates the exceptions with one of the class constants as error code.
- * The error message will be generated automatically from the code with
- * the file $filename specified in it.
- *
- * @param int $code
- * @param string $filename
- */
- public function __construct( $code, $filename )
- {
- switch ( $code )
- {
- case self::FILE_NOT_FOUND:
- $message = "The INI file <$filename> could not be found";
- break;
- case self::FILE_NOT_READABLE:
- $message = "The INI file <$filename> could not be opened for
reading";
- break;
- case self::FILE_NOT_WRITABLE:
- $message = "The INI file <$filename> could not be opened for
writing";
- break;
- }
- parent::__construct( $message, $code );
- }
-}
-?>
Modified: packages/Configuration/trunk/src/file_reader.php
===================================================================
--- packages/Configuration/trunk/src/file_reader.php 2006-01-13 13:36:40 UTC
(rev 1829)
+++ packages/Configuration/trunk/src/file_reader.php 2006-01-13 14:01:01 UTC
(rev 1830)
@@ -130,7 +130,7 @@
case 'useComments':
if ( gettype( $value ) != 'boolean' )
{
- throw new ezcBaseSettingValueException( $name, $value,
'boolean' );
+ throw new ezcBaseSettingValueException( $name, $value,
'bool' );
}
$this->useComments = $value;
break;
Modified: packages/Configuration/trunk/src/file_writer.php
===================================================================
--- packages/Configuration/trunk/src/file_writer.php 2006-01-13 13:36:40 UTC
(rev 1829)
+++ packages/Configuration/trunk/src/file_writer.php 2006-01-13 14:01:01 UTC
(rev 1830)
@@ -303,18 +303,18 @@
case 'useComments':
if ( gettype( $value ) != 'boolean' )
{
- throw new ezcBaseSettingValueException( $name, $value,
'boolean' );
+ throw new ezcBaseSettingValueException( $name, $value,
'bool' );
}
$this->useComments = $value;
break;
case 'permissions':
if ( gettype( $value ) != 'integer' )
{
- throw new ezcBaseSettingValueException( $name, $value,
'integer, 0 - 0777' );
+ throw new ezcBaseSettingValueException( $name, $value,
'int, 0 - 0777' );
}
if ( $value < 0 || $value > 0777 )
{
- throw new ezcBaseSettingValueException( $name, $value,
'integer, 0 - 0777' );
+ throw new ezcBaseSettingValueException( $name, $value,
'int, 0 - 0777' );
}
$this->permissions = $value;
break;
Modified: packages/Configuration/trunk/src/ini/ini_parser.php
===================================================================
--- packages/Configuration/trunk/src/ini/ini_parser.php 2006-01-13 13:36:40 UTC
(rev 1829)
+++ packages/Configuration/trunk/src/ini/ini_parser.php 2006-01-13 14:01:01 UTC
(rev 1830)
@@ -92,7 +92,7 @@
$this->fp = @fopen( $path, 'rt' );
if ( !$this->fp )
{
- throw new ezcConfigurationFileException(
ezcConfigurationFileException::FILE_NOT_FOUND, $path );
+ throw new ezcBaseFileNotFoundException( $path );
}
$this->parserType = $type;
$this->path = $path;
Modified: packages/Configuration/trunk/tests/configuration_array_writer_test.php
===================================================================
--- packages/Configuration/trunk/tests/configuration_array_writer_test.php
2006-01-13 13:36:40 UTC (rev 1829)
+++ packages/Configuration/trunk/tests/configuration_array_writer_test.php
2006-01-13 14:01:01 UTC (rev 1830)
@@ -43,7 +43,7 @@
}
catch ( ezcBaseSettingValueException $e )
{
- self::assertEquals( "The value <tests/translations> that you were
trying to assign to setting <useComments> is invalid. Allowed values are:
boolean", $e->getMessage() );
+ self::assertEquals( "The value <tests/translations> that you were
trying to assign to setting <useComments> is invalid. Allowed values are:
bool", $e->getMessage() );
}
}
@@ -63,7 +63,7 @@
}
catch ( ezcBaseSettingValueException $e )
{
- 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() );
+ self::assertEquals( "The value <tests/translations> that you were
trying to assign to setting <permissions> is invalid. Allowed values are: int,
0 - 0777", $e->getMessage() );
}
}
@@ -77,7 +77,7 @@
}
catch ( ezcBaseSettingValueException $e )
{
- self::assertEquals( "The value <-1> that you were trying to assign
to setting <permissions> is invalid. Allowed values are: integer, 0 - 0777",
$e->getMessage() );
+ self::assertEquals( "The value <-1> that you were trying to assign
to setting <permissions> is invalid. Allowed values are: int, 0 - 0777",
$e->getMessage() );
}
}
@@ -91,7 +91,7 @@
}
catch ( ezcBaseSettingValueException $e )
{
- self::assertEquals( "The value <512> that you were trying to
assign to setting <permissions> is invalid. Allowed values are: integer, 0 -
0777", $e->getMessage() );
+ self::assertEquals( "The value <512> that you were trying to
assign to setting <permissions> is invalid. Allowed values are: int, 0 - 0777",
$e->getMessage() );
}
}
Modified: packages/Configuration/trunk/tests/configuration_ini_reader_test.php
===================================================================
--- packages/Configuration/trunk/tests/configuration_ini_reader_test.php
2006-01-13 13:36:40 UTC (rev 1829)
+++ packages/Configuration/trunk/tests/configuration_ini_reader_test.php
2006-01-13 14:01:01 UTC (rev 1830)
@@ -31,7 +31,7 @@
}
catch ( ezcBaseSettingValueException $e )
{
- self::assertEquals( "The value <tests/translations> that you were
trying to assign to setting <useComments> is invalid. Allowed values are:
boolean", $e->getMessage() );
+ self::assertEquals( "The value <tests/translations> that you were
trying to assign to setting <useComments> is invalid. Allowed values are:
bool", $e->getMessage() );
}
}
@@ -139,9 +139,9 @@
$backend->load();
$this->fail( 'Expected exception not thrown' );
}
- catch ( ezcConfigurationFileException $e )
+ catch ( ezcBaseFileNotFoundException $e )
{
- $this->assertEquals(
ezcConfigurationFileException::FILE_NOT_FOUND, $e->getCode() );
+ $this->assertEquals( "The file
<Configuration/trunk/tests/files/non-existent.ini> could not be found.",
$e->getMessage() );
}
}
Modified: packages/Configuration/trunk/tests/configuration_ini_writer_test.php
===================================================================
--- packages/Configuration/trunk/tests/configuration_ini_writer_test.php
2006-01-13 13:36:40 UTC (rev 1829)
+++ packages/Configuration/trunk/tests/configuration_ini_writer_test.php
2006-01-13 14:01:01 UTC (rev 1830)
@@ -43,7 +43,7 @@
}
catch ( ezcBaseSettingValueException $e )
{
- self::assertEquals( "The value <tests/translations> that you were
trying to assign to setting <useComments> is invalid. Allowed values are:
boolean", $e->getMessage() );
+ self::assertEquals( "The value <tests/translations> that you were
trying to assign to setting <useComments> is invalid. Allowed values are:
bool", $e->getMessage() );
}
}
@@ -63,7 +63,7 @@
}
catch ( ezcBaseSettingValueException $e )
{
- 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() );
+ self::assertEquals( "The value <tests/translations> that you were
trying to assign to setting <permissions> is invalid. Allowed values are: int,
0 - 0777", $e->getMessage() );
}
}
@@ -77,7 +77,7 @@
}
catch ( ezcBaseSettingValueException $e )
{
- self::assertEquals( "The value <-1> that you were trying to assign
to setting <permissions> is invalid. Allowed values are: integer, 0 - 0777",
$e->getMessage() );
+ self::assertEquals( "The value <-1> that you were trying to assign
to setting <permissions> is invalid. Allowed values are: int, 0 - 0777",
$e->getMessage() );
}
}
@@ -91,7 +91,7 @@
}
catch ( ezcBaseSettingValueException $e )
{
- self::assertEquals( "The value <512> that you were trying to
assign to setting <permissions> is invalid. Allowed values are: integer, 0 -
0777", $e->getMessage() );
+ self::assertEquals( "The value <512> that you were trying to
assign to setting <permissions> is invalid. Allowed values are: int, 0 - 0777",
$e->getMessage() );
}
}
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components