assertEquals( "The setting is not a valid configuration setting.", $e->getMessage() ); } } public function testConfigExceptionOutOfRange1() { try { throw new ezcBaseSettingValueException( 'broken', 42 ); } catch ( ezcBaseSettingValueException $e ) { $this->assertEquals( "The value <42> that you were trying to assign to setting is invalid.", $e->getMessage() ); } } public function testConfigExceptionOutOfRange2() { try { throw new ezcBaseSettingValueException( 'broken', 42, "int, 40 - 48" ); } catch ( ezcBaseSettingValueException $e ) { $this->assertEquals( "The value <42> that you were trying to assign to setting is invalid. Allowed values are: int, 40 - 48", $e->getMessage() ); } } public function testFileIoException1() { try { throw new ezcBaseFileIoException( 'testfile.php', ezcBaseFileException::READ ); } catch ( ezcBaseFileIoException $e ) { $this->assertEquals( "An error occurred while reading from .", $e->getMessage() ); } } public function testFileIoException2() { try { throw new ezcBaseFileIoException( 'testfile.php', ezcBaseFileException::WRITE ); } catch ( ezcBaseFileIoException $e ) { $this->assertEquals( "An error occurred while writing to .", $e->getMessage() ); } } public function testFileIoException3() { try { throw new ezcBaseFileIoException( 'testfile.php', ezcBaseFileException::WRITE, "Extra extra" ); } catch ( ezcBaseFileIoException $e ) { $this->assertEquals( "An error occurred while writing to . (Extra extra)", $e->getMessage() ); } } public function testFileNotFoundException1() { try { throw new ezcBaseFileNotFoundException( 'testfile.php' ); } catch ( ezcBaseFileNotFoundException $e ) { $this->assertEquals( "The file could not be found.", $e->getMessage() ); } } public function testFileNotFoundException2() { try { throw new ezcBaseFileNotFoundException( 'testfile.php', 'INI' ); } catch ( ezcBaseFileNotFoundException $e ) { $this->assertEquals( "The INI file could not be found.", $e->getMessage() ); } } public function testFileNotFoundException3() { try { throw new ezcBaseFileNotFoundException( 'testfile.php', 'INI', "Extra extra" ); } catch ( ezcBaseFileNotFoundException $e ) { $this->assertEquals( "The INI file could not be found. (Extra extra)", $e->getMessage() ); } } public function testFilePermissionException1() { try { throw new ezcBaseFilePermissionException( 'testfile.php', ezcBaseFileException::READ ); } catch ( ezcBaseFilePermissionException $e ) { $this->assertEquals( "The file can not be opened for reading.", $e->getMessage() ); } } public function testFilePermissionException2() { try { throw new ezcBaseFilePermissionException( 'testfile.php', ezcBaseFileException::WRITE ); } catch ( ezcBaseFileException $e ) { $this->assertEquals( "The file can not be opened for writing.", $e->getMessage() ); } } public function testFilePermissionException3() { try { throw new ezcBaseFilePermissionException( 'testfile.php', ezcBaseFileException::EXECUTE ); } catch ( ezcBaseException $e ) { $this->assertEquals( "The file can not be executed.", $e->getMessage() ); } } public function testFilePermissionException4() { try { throw new ezcBaseFilePermissionException( 'testfile.php', ezcBaseFilePermissionException::CHANGE, "Extra extra" ); } catch ( ezcBaseException $e ) { $this->assertEquals( "The permissions for can not be changed. (Extra extra)", $e->getMessage() ); } } public function testFilePermissionException5() { try { throw new ezcBaseFilePermissionException( 'testfile.php', ezcBaseFilePermissionException::READ | ezcBaseFilePermissionException::WRITE, "Extra extra" ); } catch ( ezcBaseException $e ) { $this->assertEquals( "The file can not be opened for reading and writing. (Extra extra)", $e->getMessage() ); } } public function testPropertyNotFoundException() { try { throw new ezcBasePropertyNotFoundException( 'broken' ); } catch ( ezcBasePropertyNotFoundException $e ) { $this->assertEquals( "No such property name .", $e->getMessage() ); } } public function testPropertyPermissionException1() { try { throw new ezcBasePropertyPermissionException( 'broken', ezcBasePropertyPermissionException::READ ); } catch ( ezcBaseException $e ) { $this->assertEquals( "The property is read-only.", $e->getMessage() ); } } public function testPropertyPermissionException2() { try { throw new ezcBasePropertyPermissionException( 'broken', ezcBasePropertyPermissionException::WRITE ); } catch ( ezcBaseException $e ) { $this->assertEquals( "The property is write-only.", $e->getMessage() ); } } public function testBaseValue1() { try { throw new ezcBaseValueException( 'broken', array( 42 ) ); } catch ( ezcBaseValueException $e ) { $this->assertEquals( "The value that you were trying to assign to setting is invalid.", $e->getMessage() ); } } public function testBaseValue2() { try { throw new ezcBaseValueException( 'broken', "string", "strings" ); } catch ( ezcBaseValueException $e ) { $this->assertEquals( "The value that you were trying to assign to setting is invalid. Allowed values are: strings.", $e->getMessage() ); } } public static function suite() { return new ezcTestSuite("ezcBaseTest"); } } ?>