blessing-skin-server/tests/ServicesTest/OptionTest.php

31 lines
641 B
PHP
Raw Normal View History

<?php
2018-08-17 15:25:08 +08:00
namespace Tests;
2019-03-23 15:44:16 +08:00
use App\Services\Option;
use Illuminate\Foundation\Testing\DatabaseTransactions;
2019-03-23 15:44:16 +08:00
class OptionTest extends TestCase
{
use DatabaseTransactions;
public function testGet()
{
2019-03-23 15:44:16 +08:00
$repo = new Option();
$repo->set('k1', '(null)');
$this->assertNull($repo->get('k1'));
2019-03-22 11:13:21 +08:00
$this->assertNull(option()->get('k1'));
}
public function testSet()
{
2019-03-23 15:44:16 +08:00
$repo = new Option();
$repo->set([
'k1' => 'v1',
'k2' => 'v2',
]);
$this->assertEquals('v1', $repo->get('k1'));
$this->assertEquals('v2', $repo->get('k2'));
}
}