metadata_pear_test.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 ezcBaseMetaDataPearTest extends ezcTestCase
  31. {
  32. public function setUp()
  33. {
  34. $this->markTestSkipped('Only work when Zeta Components is installed as pear package.');
  35. }
  36. public static function testConstruct()
  37. {
  38. $r = new ezcBaseMetaData( 'pear' );
  39. self::assertInstanceOf( 'ezcBaseMetaData', $r );
  40. self::assertInstanceOf( 'ezcBaseMetaDataPearReader', self::readAttribute( $r, 'reader' ) );
  41. }
  42. public static function testGetBundleVersion()
  43. {
  44. $r = new ezcBaseMetaData( 'pear' );
  45. $release = $r->getBundleVersion();
  46. self::assertInternalType( 'string', $release );
  47. self::assertRegexp( '@[0-9]{4}\.[0-9](\.[0-9])?@', $release );
  48. }
  49. public static function testIsComponentInstalled()
  50. {
  51. $r = new ezcBaseMetaData( 'pear' );
  52. self::assertTrue( $r->isComponentInstalled( 'Base' ) );
  53. self::assertFalse( $r->isComponentInstalled( 'DefinitelyNot' ) );
  54. }
  55. public static function testGetComponentVersion()
  56. {
  57. $r = new ezcBaseMetaData( 'pear' );
  58. $release = $r->getComponentVersion( 'Base' );
  59. self::assertInternalType( 'string', $release );
  60. self::assertRegexp( '@[0-9]\.[0-9](\.[0-9])?@', $release );
  61. self::assertFalse( $r->getComponentVersion( 'DefinitelyNot' ) );
  62. }
  63. public static function testGetComponentDependencies1()
  64. {
  65. $r = new ezcBaseMetaData( 'pear' );
  66. $deps = array_keys( $r->getComponentDependencies() );
  67. self::assertContains( 'Base', $deps );
  68. self::assertContains( 'Cache', $deps );
  69. self::assertContains( 'Webdav', $deps );
  70. self::assertNotContains( 'Random', $deps );
  71. }
  72. public static function testGetComponentDependencies2()
  73. {
  74. $r = new ezcBaseMetaData( 'pear' );
  75. self::assertSame( array(), $r->getComponentDependencies( 'Base' ) );
  76. self::assertSame( array( 'Base' ), array_keys( $r->getComponentDependencies( 'Template' ) ) );
  77. }
  78. public static function testGetComponentDependencies3()
  79. {
  80. $r = new ezcBaseMetaData( 'pear' );
  81. self::assertContains( 'Base', array_keys( $r->getComponentDependencies( 'TemplateTranslationTiein' ) ) );
  82. self::assertContains( 'Template', array_keys( $r->getComponentDependencies( 'TemplateTranslationTiein' ) ) );
  83. self::assertContains( 'Translation', array_keys( $r->getComponentDependencies( 'TemplateTranslationTiein' ) ) );
  84. }
  85. public static function suite()
  86. {
  87. return new PHPUnit_Framework_TestSuite( 'ezcBaseMetaDataPearTest' );
  88. }
  89. }
  90. ?>