InfoXmlTest.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. if (isset($appInfo['background-jobs'])) {
  61. foreach ($appInfo['background-jobs'] as $job) {
  62. $this->assertTrue(class_exists($job), 'Asserting background job "' . $job . '" exists');
  63. $this->assertInstanceOf($job, \OC::$server->query($job));
  64. }
  65. }
  66. if (isset($appInfo['two-factor-providers'])) {
  67. foreach ($appInfo['two-factor-providers'] as $provider) {
  68. $this->assertTrue(class_exists($provider), 'Asserting two-factor providers "' . $provider . '" exists');
  69. $this->assertInstanceOf($provider, \OC::$server->query($provider));
  70. }
  71. }
  72. if (isset($appInfo['commands'])) {
  73. foreach ($appInfo['commands'] as $command) {
  74. $this->assertTrue(class_exists($command), 'Asserting command "' . $command . '" exists');
  75. $this->assertInstanceOf($command, \OC::$server->query($command));
  76. }
  77. }
  78. if (isset($appInfo['repair-steps']['pre-migration'])) {
  79. foreach ($appInfo['repair-steps']['pre-migration'] as $migration) {
  80. $this->assertTrue(class_exists($migration), 'Asserting pre-migration "' . $migration . '" exists');
  81. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  82. }
  83. }
  84. if (isset($appInfo['repair-steps']['post-migration'])) {
  85. foreach ($appInfo['repair-steps']['post-migration'] as $migration) {
  86. $this->assertTrue(class_exists($migration), 'Asserting post-migration "' . $migration . '" exists');
  87. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  88. }
  89. }
  90. if (isset($appInfo['repair-steps']['live-migration'])) {
  91. foreach ($appInfo['repair-steps']['live-migration'] as $migration) {
  92. $this->assertTrue(class_exists($migration), 'Asserting live-migration "' . $migration . '" exists');
  93. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  94. }
  95. }
  96. if (isset($appInfo['repair-steps']['install'])) {
  97. foreach ($appInfo['repair-steps']['install'] as $migration) {
  98. $this->assertTrue(class_exists($migration), 'Asserting install-migration "' . $migration . '" exists');
  99. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  100. }
  101. }
  102. if (isset($appInfo['repair-steps']['uninstall'])) {
  103. foreach ($appInfo['repair-steps']['uninstall'] as $migration) {
  104. $this->assertTrue(class_exists($migration), 'Asserting uninstall-migration "' . $migration . '" exists');
  105. $this->assertInstanceOf($migration, \OC::$server->query($migration));
  106. }
  107. }
  108. if (isset($appInfo['commands'])) {
  109. foreach ($appInfo['commands'] as $command) {
  110. $this->assertTrue(class_exists($command), 'Asserting command "'. $command . '"exists');
  111. $this->assertInstanceOf($command, \OC::$server->query($command));
  112. }
  113. }
  114. }
  115. }