Files
FOSSBilling/tests/integration/bb-library/Box/DiTest.php
T
Belle Aerni 50043e6211 Run Rector against our tests (#1761)
* Update rector config to include tests

* Run Rector against the tests

* Delete test-results

* Update .gitignore

* Correctly set the PHP min to 8.1, split the configs

* Corrected PHPDoc

* Deleted tests we can't really get to pass

PHPunit is hard-coded to fail when a class has a return type of `never`, which is the correct return type of our redirect function (and rightfully so).

No way to disable the exception as far as we can tell
2023-11-11 18:41:09 +00:00

47 lines
2.2 KiB
PHP

<?php
class DiTest extends PHPUnit\Framework\TestCase
{
public function setup(): void
{
global $di;
$this->di = clone $di;
}
public function testInjector()
{
$di = $this->di;
$this->assertInstanceOf('Box_Mod', $di['mod']('admin'));
$this->assertInstanceOf('Box_Log', $di['logger']);
$this->assertInstanceOf('Box_Crypt', $di['crypt']);
$this->assertTrue(isset($di['pdo']));
$this->assertTrue(isset($di['db']));
$this->assertInstanceOf('Box_Pagination', $di['pager']);
$this->assertInstanceOf('Box_Url', $di['url']);
$this->assertInstanceOf('Box_EventManager', $di['events_manager']);
$this->assertInstanceOf('\\' . \FOSSBilling\Session::class, $di['session']);
$this->assertInstanceOf('Box_Authorization', $di['auth']);
$this->assertInstanceOf(\Twig\Environment::class, $di['twig']);
$this->assertInstanceOf('\\' . \FOSSBilling\Tools::class, $di['tools']);
$this->assertInstanceOf('\\' . \FOSSBilling\Validate::class, $di['validator']);
$this->assertTrue(isset($di['mod']));
$this->assertTrue(isset($di['mod_config']));
$this->assertInstanceOf(\Box\Mod\Cron\Service::class, $di['mod_service']('cron'));
$this->assertInstanceOf('\\' . \FOSSBilling\ExtensionManager::class, $di['extension_manager']);
$this->assertInstanceOf('\Box_Update', $di['updater']);
$this->assertInstanceOf('\Server_Package', $di['server_package']);
$this->assertInstanceOf('\Server_Client', $di['server_client']);
$this->assertInstanceOf('\Server_Account', $di['server_account']);
$this->assertTrue(isset($di['server_manager']));
$this->assertInstanceOf('\\' . \FOSSBilling\Requirements::class, $di['requirements']);
$this->assertInstanceOf('\\' . \Box\Mod\Theme\Model\Theme::class, $di['theme']);
$this->assertInstanceOf('\Model_Cart', $di['cart']);
$this->assertInstanceOf('\\' . \GeoIp2\Database\Reader::class, $di['geoip']);
$this->assertInstanceOf('\Box_Password', $di['password']);
$this->assertInstanceOf('\Box_Translate', $di['translate']());
}
}