PageRenderTime 49ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/Onion/Pear/PackageXmlParserTest.php

http://github.com/c9s/Onion
PHP | 132 lines | 111 code | 10 blank | 11 comment | 2 complexity | 241bfc4290bfcf179049020d7d0c73d3 MD5 | raw file
Possible License(s): GPL-2.0
  1. <?php
  2. /*
  3. * This file is part of the {{ }} package.
  4. *
  5. * (c) Yo-An Lin <cornelius.howl@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. *
  10. */
  11. namespace tests\Onion\Pear;
  12. class PackageXmlParserTest extends \PHPUnit_Framework_TestCase
  13. {
  14. function test2()
  15. {
  16. $p = new \Onion\Pear\PackageXmlParser( 'tests/data/package_xml/Twig/package.xml' );
  17. ok( $p );
  18. $list = $p->getContentFiles();
  19. ok( $list );
  20. ok( $list = $p->getContentFilesByRole( 'php' ));
  21. }
  22. function test()
  23. {
  24. # spec from http://pear.php.net/manual/en/guide.developers.package2.dir.php
  25. $xmlstr =<<<EOT
  26. <?xml version="1.0" encoding="UTF-8"?>
  27. <package>
  28. <name>PHP_Timer</name>
  29. <channel>pear.phpunit.de</channel>
  30. <summary>Utility class for timing</summary>
  31. <description>Utility class for timing</description>
  32. <lead>
  33. <name>Sebastian Bergmann</name>
  34. <user>sb</user>
  35. <email>sb@sebastian-bergmann.de</email>
  36. <active>yes</active>
  37. </lead>
  38. <date>2011-09-07</date>
  39. <time>11:38:14</time>
  40. <version>
  41. <release>1.0.2</release>
  42. <api>1.0.0</api>
  43. </version>
  44. <stability>
  45. <release>stable</release>
  46. <api>stable</api>
  47. </stability>
  48. <license>BSD License</license>
  49. <notes>
  50. http://github.com/sebastianbergmann/php-timer/blob/master/README.markdown
  51. </notes>
  52. <contents>
  53. <dir name="/">
  54. <dir name="examples">
  55. <file name="authors.php" role="doc"/>
  56. </dir>
  57. <dir name="HTML">
  58. <dir name="Template">
  59. <file name="PHPLIB.php" role="php" />
  60. <dir name="PHPLIB">
  61. <file name="TEST.php" role="php" />
  62. </dir>
  63. </dir>
  64. </dir>
  65. </dir>
  66. <dir name="/" baseinstalldir="HTML">
  67. <dir name="QuickForm">
  68. <file name="Element.php" role="php" />
  69. <!-- would be installed as HTML/QuickForm/Element.php -->
  70. </dir>
  71. </dir>
  72. <dir name="/">
  73. <file md5sum="2b7116a9f3bf6f9e8cd914c81bf79830" name="lib/sfYaml.php" role="php" />
  74. <file md5sum="28196a0efdcea67d72e1eaf71e936958" name="lib/sfYamlDumper.php" role="php" />
  75. <file md5sum="cb97a7ac95e5c6df398514b43dfe9191" name="lib/sfYamlInline.php" role="php" />
  76. <file md5sum="02fc0966083c293c851f2de6abb24875" name="lib/sfYamlParser.php" role="php" />
  77. <file md5sum="872df9017f6485111a36d2ce9c1e8bdc" name="README.markdown" role="doc" />
  78. <file md5sum="4828aab1cb984d8a5d29e1c0df3cdcbd" name="LICENSE" role="doc" />
  79. </dir>
  80. <dir name="/">
  81. <file install-as="Onion/Application.php" name="src/Onion/Application.php" role="php" md5sum="cd08c9e1a21ce6d2f7ef0c0fc2ed849f"/>
  82. <file install-as="Onion/Command/BuildCommand.php" name="src/Onion/Command/BuildCommand.php" role="php" md5sum="c6c609136de4828b2f4e9d1624dbfd6c"/>
  83. <file install-as="Onion/Command/BundleCommand.php" name="src/Onion/Command/BundleCommand.php" role="php" md5sum="aa7a8d364e4d0f2ab041571e2f4e5fc8"/>
  84. <file install-as="Onion/Command/CompileCommand.php" name="src/Onion/Command/CompileCommand.php" role="php" md5sum="3bd78385317b655917bd82c9a1cb35af"/>
  85. <file install-as="Onion/Command/InitCommand.php" name="src/Onion/Command/InitCommand.php" role="php" md5sum="9ee53174df1f1ba932e0e449c1f912a7"/>
  86. <file install-as="Onion/ConfigContainer.php" name="src/Onion/ConfigContainer.php" role="php" md5sum="2bf0c59c46a1eb98cf33acefc4097a1c"/>
  87. <file install-as="Onion/GlobalConfig.php" name="src/Onion/GlobalConfig.php" role="php" md5sum="b2de5f4a4f385dea7e86598d6f3f11d9"/>
  88. <file install-as="Onion/Onion.php" name="src/Onion/Onion.php" role="php" md5sum="6a4e7d381b3cb0d8d67d3a7e35ac2537"/>
  89. <file install-as="Onion/PackageConfigReader.php" name="src/Onion/PackageConfigReader.php" role="php" md5sum="22fd847bbffeec43e82563351540441f"/>
  90. <file install-as="Onion/Packager.php" name="src/Onion/Packager.php" role="php" md5sum="2fffec686af34345d9faef2efc04eb4a"/>
  91. <file install-as="Onion/PackageXml/PackageXmlWriter.php" name="src/Onion/PackageXml/PackageXmlWriter.php" role="php" md5sum="0913c185e0731fc1f8b2a126d24a39fb"/>
  92. <file install-as="Onion/SpecUtils.php" name="src/Onion/SpecUtils.php" role="php" md5sum="3acf35cf3fd15ae23eef6dabb0d210bd"/>
  93. <file install-as="Onion/TestCommand/ParentCommand/SubCommand.php" name="src/Onion/TestCommand/ParentCommand/SubCommand.php" role="php" md5sum="a69e9e6477f7d4d82f30b5769eae073e"/>
  94. <file install-as="Onion/TestCommand/ParentCommand.php" name="src/Onion/TestCommand/ParentCommand.php" role="php" md5sum="9bec2094c780a962306c2febc669f8b8"/>
  95. <file install-as="bootstrap.php" name="tests/bootstrap.php" role="test" md5sum="a4dcfe19452fe6d10e9349fdb424b80d"/>
  96. <file install-as="helpers.php" name="tests/helpers.php" role="test" md5sum="442b22ed35a844926391dc62c49ec706"/>
  97. <file install-as="Onion/ConfigContainerTest.php" name="tests/Onion/ConfigContainerTest.php" role="test" md5sum="6d12e7f7d407508d04bbf696ab8d988e"/>
  98. </dir>
  99. </contents>
  100. <phprelease>
  101. <filelist>
  102. <install as="SymfonyComponents/YAML/sfYaml.php" name="lib/sfYaml.php" />
  103. <install as="SymfonyComponents/YAML/sfYamlDumper.php" name="lib/sfYamlDumper.php" />
  104. <install as="SymfonyComponents/YAML/sfYamlInline.php" name="lib/sfYamlInline.php" />
  105. <install as="SymfonyComponents/YAML/sfYamlParser.php" name="lib/sfYamlParser.php" />
  106. </filelist>
  107. </phprelease>
  108. </package>
  109. EOT;
  110. $p = new \Onion\Pear\PackageXmlParser( $xmlstr );
  111. ok( $p );
  112. $list = $p->getContentFiles();
  113. ok( $list );
  114. ok( $list = $p->getContentFilesByRole( 'php' ));
  115. // var_dump( $list );
  116. $filelist = $p->getPhpReleaseFileList();
  117. ok( $filelist );
  118. foreach( $filelist as $install ) {
  119. ok( $install );
  120. }
  121. }
  122. }