You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

InfoXmlTest.php 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
  4. *
  5. * @license GNU AGPL version 3 or any later version
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Affero General Public License as
  9. * published by the Free Software Foundation, either version 3 of the
  10. * License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. *
  20. */
  21. namespace Test;
  22. /**
  23. * Class InfoXmlTest
  24. *
  25. * @group DB
  26. * @package Test
  27. */
  28. class InfoXmlTest extends TestCase {
  29. public function dataApps() {
  30. return [
  31. ['admin_audit'],
  32. ['comments'],
  33. ['dav'],
  34. ['encryption'],
  35. ['federatedfilesharing'],
  36. ['federation'],
  37. ['files'],
  38. ['files_external'],
  39. ['files_sharing'],
  40. ['files_trashbin'],
  41. ['files_versions'],
  42. ['provisioning_api'],
  43. ['systemtags'],
  44. ['theming'],
  45. ['settings'],
  46. ['twofactor_backupcodes'],
  47. ['updatenotification'],
  48. ['user_ldap'],
  49. ['workflowengine'],
  50. ];
  51. }
  52. /**
  53. * @dataProvider dataApps
  54. *
  55. * @param string $app
  56. */
  57. public function testClasses($app) {
  58. $appInfo = \OC_App::getAppInfo($app);
  59. $appPath = \OC_App::getAppPath($app);
  60. \OC_App::registerAutoloading($app, $appPath);
  61. //Add the appcontainer
  62. $applicationClassName = \OCP\AppFramework\App::buildAppNamespace($app) . '\\AppInfo\\Application';
  63. if (class_exists($applicationClassName)) {
  64. $application = new $applicationClassName();
  65. $this->addToAssertionCount(1);
  66. } else {
  67. $application = new \OCP\AppFramework\App($app);
  68. $this->addToAssertionCount(1);
  69. }
  70. if (isset($appInfo['background-jobs'])) {
  71. foreach ($appInfo['background-jobs'] as $job) {
  72. $this->assertTrue(class_exists($job), 'Asserting background job "' . $job . '" exists');
  73. $this->assertInstanceOf($job, \OC::$server->query($job));
  74. }
  75. }
  76. if (isset($appInfo['two-factor-providers'])) {
  77. foreach ($appInfo['two-factor-providers'] as $provider) {
  78. $this->assertTrue(class_exists($provider), 'Asserting two-factor providers "' . $provider . '" exists');
  79. $this->assertInstanceOf($provider, \OC::$server->query($provider));
  80. }
  81. }
  82. if (isset($appInfo['commands'])) {
  83. foreach ($appInfo['commands'] as $command) {
  84. $this->assertTrue(class_exists($command), 'Asserting command "' . $command . '" exists');
  85. $this->assertInstanceOf($command, \OC::$server->query($command));
  86. }
  87. }
  88. if (isset($appInfo['repair-steps']['pre-migration'])) {
  89. foreach ($appInfo['repair-steps']['pre-migration'] as $migration) {
  90. $this->assertTrue(class_exists($migration), 'Asserting pre-migration "' . $migration . '" exists');
  91. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  92. }
  93. }
  94. if (isset($appInfo['repair-steps']['post-migration'])) {
  95. foreach ($appInfo['repair-steps']['post-migration'] as $migration) {
  96. $this->assertTrue(class_exists($migration), 'Asserting post-migration "' . $migration . '" exists');
  97. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  98. }
  99. }
  100. if (isset($appInfo['repair-steps']['live-migration'])) {
  101. foreach ($appInfo['repair-steps']['live-migration'] as $migration) {
  102. $this->assertTrue(class_exists($migration), 'Asserting live-migration "' . $migration . '" exists');
  103. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  104. }
  105. }
  106. if (isset($appInfo['repair-steps']['install'])) {
  107. foreach ($appInfo['repair-steps']['install'] as $migration) {
  108. $this->assertTrue(class_exists($migration), 'Asserting install-migration "' . $migration . '" exists');
  109. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  110. }
  111. }
  112. if (isset($appInfo['repair-steps']['uninstall'])) {
  113. foreach ($appInfo['repair-steps']['uninstall'] as $migration) {
  114. $this->assertTrue(class_exists($migration), 'Asserting uninstall-migration "' . $migration . '" exists');
  115. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  116. }
  117. }
  118. if (isset($appInfo['commands'])) {
  119. foreach ($appInfo['commands'] as $command) {
  120. $this->assertTrue(class_exists($command), 'Asserting command "'. $command . '"exists');
  121. $this->assertInstanceOf($command, \OC::$server->query($command));
  122. }
  123. }
  124. }
  125. }