| 1 |
<?php |
| 2 |
|
| 3 |
use PHPUnit\Framework\TestCase; |
| 4 |
use ResponsiveMenu\Collections\OptionsCollection; |
| 5 |
use ResponsiveMenu\Models\Option; |
| 6 |
|
| 7 |
class AdminTest extends TestCase { |
| 8 |
|
| 9 |
static public function setUpBeforeClass() { |
| 10 |
function __($a, $b) { |
| 11 |
return $a; |
| 12 |
} |
| 13 |
} |
| 14 |
public function setUp() { |
| 15 |
$this->view = $this->createMock('ResponsiveMenu\View\AdminView'); |
| 16 |
$this->service = $this->createMock('ResponsiveMenu\Services\OptionService'); |
| 17 |
$this->view->method('render')->willReturn(true); |
| 18 |
$this->view->method('display')->will($this->returnArgument(0)); |
| 19 |
$this->service->method('combineOptions')->willReturn([]); |
| 20 |
$collection = new OptionsCollection; |
| 21 |
$collection->add(new Option('a', 1)); |
| 22 |
$this->service->method('all')->willReturn($collection); |
| 23 |
$this->controller = new ResponsiveMenu\Controllers\Admin($this->service, $this->view); |
| 24 |
|
| 25 |
} |
| 26 |
|
| 27 |
public function testUpdate() { |
| 28 |
$this->assertTrue($this->controller->update([],[])); |
| 29 |
} |
| 30 |
|
| 31 |
public function testReset() { |
| 32 |
$this->assertTrue($this->controller->reset([])); |
| 33 |
} |
| 34 |
|
| 35 |
public function testIndex() { |
| 36 |
$this->assertTrue($this->controller->index([])); |
| 37 |
} |
| 38 |
|
| 39 |
public function testExport() { |
| 40 |
$this->assertNull($this->controller->export()); |
| 41 |
} |
| 42 |
|
| 43 |
public function testImportNoFile() { |
| 44 |
$this->assertTrue($this->controller->import(['a' => 1], null)); |
| 45 |
} |
| 46 |
|
| 47 |
public function testImport() { |
| 48 |
$this->assertTrue($this->controller->import(['a' => 1], ['b' => 2])); |
| 49 |
} |
| 50 |
|
| 51 |
} |
| 52 |
|