This commit is contained in:
root
2023-03-29 15:20:05 +00:00
parent 5ec489e0e0
commit a0bb8f2d1e
25468 changed files with 3063105 additions and 28 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace Tests\Unit\Helpers\SettingsHelper;
use App\Helpers\SettingsHelper;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class SettingsGetTest extends TestCase
{
use RefreshDatabase;
/**
* A basic feature test example.
*
* @return void
*/
public function testValidSetting()
{
$response = SettingsHelper::get('auth');
$this->assertNotFalse($response);
$this->assertFalse((bool)$response->value);
}
/**
* A basic feature test example.
*
* @return void
*/
public function testInvalidSetting()
{
$response = SettingsHelper::get('test');
$this->assertFalse($response);
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Tests\Unit\Helpers\SettingsHelper;
use App\Helpers\SettingsHelper;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class SettingsLoadIntegrationsConfigTest extends TestCase
{
use RefreshDatabase;
/**
* A basic feature test example.
*
* @return void
*/
public function testLoadIntegrationsConfig()
{
$preLoad = [
"healthchecks_enabled" => false,
"healthchecks_uuid" => null,
"slack_webhook" => null,
"telegram_bot_token" => null,
"telegram_chat_id" => null,
];
SettingsHelper::set('slack_webhook', 'test');
SettingsHelper::loadIntegrationConfig();
$this->assertEquals(config('integrations.slack_webhook'), 'test');
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace Tests\Unit\Helpers\SettingsHelper;
use App\Helpers\SettingsHelper;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class SettingsSetTest extends TestCase
{
use RefreshDatabase;
/**
* A basic feature test example.
*
* @return void
*/
public function testUpdatingSetting()
{
$response = SettingsHelper::set('auth', 'hello');
$this->assertEquals('hello', $response->value);
}
}