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