struct_test.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /**
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one
  5. * or more contributor license agreements. See the NOTICE file
  6. * distributed with this work for additional information
  7. * regarding copyright ownership. The ASF licenses this file
  8. * to you under the Apache License, Version 2.0 (the
  9. * "License"); you may not use this file except in compliance
  10. * with the License. You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing,
  15. * software distributed under the License is distributed on an
  16. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  17. * KIND, either express or implied. See the License for the
  18. * specific language governing permissions and limitations
  19. * under the License.
  20. *
  21. * @package Base
  22. * @subpackage Tests
  23. * @version //autogentag//
  24. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  25. */
  26. /**
  27. * @package Base
  28. * @subpackage Tests
  29. */
  30. class ezcBaseStructTest extends ezcTestCase
  31. {
  32. public function testBaseStructGetSet()
  33. {
  34. $struct = new ezcBaseStruct();
  35. try
  36. {
  37. $struct->no_such_property = 'value';
  38. $this->fail( 'Expected exception was not thrown.' );
  39. }
  40. catch ( ezcBasePropertyNotFoundException $e )
  41. {
  42. $this->assertEquals( "No such property name 'no_such_property'.", $e->getMessage() );
  43. }
  44. try
  45. {
  46. $value = $struct->no_such_property;
  47. $this->fail( 'Expected exception was not thrown.' );
  48. }
  49. catch ( ezcBasePropertyNotFoundException $e )
  50. {
  51. $this->assertEquals( "No such property name 'no_such_property'.", $e->getMessage() );
  52. }
  53. }
  54. public function testBaseRepositoryDirectorySetState()
  55. {
  56. $dir = ezcBaseRepositoryDirectory::__set_state( array( 'type' => ezcBaseRepositoryDirectory::TYPE_EXTERNAL, 'basePath' => '/tmp', 'autoloadPath' => '/tmp/autoload' ) );
  57. $this->assertEquals( ezcBaseRepositoryDirectory::TYPE_EXTERNAL, $dir->type );
  58. $this->assertEquals( '/tmp', $dir->basePath );
  59. $this->assertEquals( '/tmp/autoload', $dir->autoloadPath );
  60. }
  61. public static function suite()
  62. {
  63. return new PHPUnit_Framework_TestSuite( "ezcBaseStructTest" );
  64. }
  65. }
  66. ?>