Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
nadar committed Jun 3, 2021
1 parent e0986f3 commit 1f9bca0
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/admin/base/RadioPropertyTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

namespace luya\admin\tests\admin\base;

use admintests\AdminTestCase;
use luya\admin\base\CheckboxArrayProperty;
use luya\admin\base\CheckboxProperty;
use luya\admin\base\RadioProperty;

class RadioPropertyTest extends AdminTestCase
{
public function testDefaultAdminValue()
{
$prop = new StubCheckoxArrayProperty();

$this->assertSame(false, $prop->defaultValue());

$this->assertSame(null, $prop->getAdminValue());
$this->assertNull($prop->getValue());

$this->assertSame([
['label' => 'bar', 'value' => 'foo'],
['label' => 'foo', 'value' => 'baz'],
], $prop->options());
}
}

class StubCheckoxArrayProperty extends RadioProperty
{
public function varName()
{
return 'varname';
}

public function label()
{
return 'label';
}

public function items()
{
return [
'foo' => 'bar',
'baz' => 'foo',
];
}
}

0 comments on commit 1f9bca0

Please sign in to comment.