3 namespace Friendica\Test\src\Module\Api;
6 use Friendica\Core\Addon;
7 use Friendica\Core\Hook;
8 use Friendica\Database\Database;
10 use Friendica\Security\Authentication;
11 use Friendica\Test\FixtureTest;
12 use Friendica\Test\Util\AuthenticationDouble;
14 class ApiTest extends FixtureTest
16 protected function setUp(): void
18 parent::setUp(); // TODO: Change the autogenerated stub
20 $this->dice = $this->dice
21 ->addRule(Authentication::class, ['instanceOf' => AuthenticationDouble::class, 'shared' => true]);
22 DI::init($this->dice);
24 $this->installAuthTest();
32 public function installAuthTest()
35 $addon_file_path = __DIR__ . '/../../../Util/authtest/authtest.php';
36 $t = @filemtime($addon_file_path);
38 @include_once($addon_file_path);
39 if (function_exists($addon . '_install')) {
40 $func = $addon . '_install';
44 /** @var Database $dba */
45 $dba = $this->dice->create(Database::class);
47 $dba->insert('addon', [
51 'plugin_admin' => function_exists($addon . '_addon_admin'),
52 'hidden' => file_exists('addon/' . $addon . '/.hidden')