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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. ['twofactor_backupcodes'],
  46. ['updatenotification'],
  47. ['user_ldap'],
  48. ['workflowengine'],
  49. ];
  50. }
  51. /**
  52. * @dataProvider dataApps
  53. *
  54. * @param string $app
  55. */
  56. public function testClasses($app) {
  57. $appInfo = \OC_App::getAppInfo($app);
  58. $appPath = \OC_App::getAppPath($app);
  59. \OC_App::registerAutoloading($app, $appPath);
  60. //Add the appcontainer
  61. $applicationClassName = \OCP\AppFramework\App::buildAppNamespace($app) . '\\AppInfo\\Application';
  62. if (class_exists($applicationClassName)) {
  63. $application = new $applicationClassName();
  64. $this->addToAssertionCount(1);
  65. } else {
  66. $application = new \OCP\AppFramework\App($app);
  67. $this->addToAssertionCount(1);
  68. }
  69. if (isset($appInfo['background-jobs'])) {
  70. foreach ($appInfo['background-jobs'] as $job) {
  71. $this->assertTrue(class_exists($job), 'Asserting background job "' . $job . '" exists');
  72. $this->assertInstanceOf($job, \OC::$server->query($job));
  73. }
  74. }
  75. if (isset($appInfo['two-factor-providers'])) {
  76. foreach ($appInfo['two-factor-providers'] as $provider) {
  77. $this->assertTrue(class_exists($provider), 'Asserting two-factor providers "' . $provider . '" exists');
  78. $this->assertInstanceOf($provider, \OC::$server->query($provider));
  79. }
  80. }
  81. if (isset($appInfo['commands'])) {
  82. foreach ($appInfo['commands'] as $command) {
  83. $this->assertTrue(class_exists($command), 'Asserting command "' . $command . '" exists');
  84. $this->assertInstanceOf($command, \OC::$server->query($command));
  85. }
  86. }
  87. if (isset($appInfo['repair-steps']['pre-migration'])) {
  88. foreach ($appInfo['repair-steps']['pre-migration'] as $migration) {
  89. $this->assertTrue(class_exists($migration), 'Asserting pre-migration "' . $migration . '" exists');
  90. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  91. }
  92. }
  93. if (isset($appInfo['repair-steps']['post-migration'])) {
  94. foreach ($appInfo['repair-steps']['post-migration'] as $migration) {
  95. $this->assertTrue(class_exists($migration), 'Asserting post-migration "' . $migration . '" exists');
  96. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  97. }
  98. }
  99. if (isset($appInfo['repair-steps']['live-migration'])) {
  100. foreach ($appInfo['repair-steps']['live-migration'] as $migration) {
  101. $this->assertTrue(class_exists($migration), 'Asserting live-migration "' . $migration . '" exists');
  102. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  103. }
  104. }
  105. if (isset($appInfo['repair-steps']['install'])) {
  106. foreach ($appInfo['repair-steps']['install'] as $migration) {
  107. $this->assertTrue(class_exists($migration), 'Asserting install-migration "' . $migration . '" exists');
  108. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  109. }
  110. }
  111. if (isset($appInfo['repair-steps']['uninstall'])) {
  112. foreach ($appInfo['repair-steps']['uninstall'] as $migration) {
  113. $this->assertTrue(class_exists($migration), 'Asserting uninstall-migration "' . $migration . '" exists');
  114. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  115. }
  116. }
  117. if (isset($appInfo['commands'])) {
  118. foreach ($appInfo['commands'] as $command) {
  119. $this->assertTrue(class_exists($command), 'Asserting command "'. $command . '"exists');
  120. $this->assertInstanceOf($command, \OC::$server->query($command));
  121. }
  122. }
  123. }
  124. }