blessing-skin-server/tests/ServicesTest/RepositoriesTest/OptionRepositoryTest.php
Pig Fang 3cf19d8656
Apply fixes from StyleCI (#11)
This pull request applies code style fixes from an analysis carried out by [StyleCI](https://github.styleci.io).

---

For more information, click [here](https://github.styleci.io/analyses/8wKwbZ).
2019-03-02 22:58:37 +08:00

44 lines
967 B
PHP

<?php
namespace Tests;
use App\Services\Repositories\OptionRepository;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class OptionRepositoryTest extends TestCase
{
use DatabaseTransactions;
public function testGet()
{
$repo = new OptionRepository();
$repo->set('k1', '(null)');
$this->assertNull($repo->get('k1'));
}
public function testSet()
{
$repo = new OptionRepository();
$repo->set([
'k1' => 'v1',
'k2' => 'v2',
]);
$this->assertEquals('v1', $repo->get('k1'));
$this->assertEquals('v2', $repo->get('k2'));
}
public function testOnly()
{
$repo = new OptionRepository();
$repo->set([
'k1' => 'v1',
'k2' => 'v2',
'k3' => 'v3',
]);
$this->assertArraySubset([
'k1' => 'v1',
'k2' => 'v2',
], $repo->only(['k1', 'k2']));
}
}