| 1 |
<?php |
| 2 |
|
| 3 |
use PHPUnit\Framework\TestCase; |
| 4 |
use ResponsiveMenu\Factories\CssFactory; |
| 5 |
use ResponsiveMenu\Collections\OptionsCollection; |
| 6 |
use ResponsiveMenu\Models\Option; |
| 7 |
|
| 8 |
class CssFactoryTest extends TestCase { |
| 9 |
|
| 10 |
public function setUp() { |
| 11 |
$this->base_mapper = $this->createMock('ResponsiveMenu\Mappers\ScssBaseMapper'); |
| 12 |
$this->button_mapper = $this->createMock('ResponsiveMenu\Mappers\ScssButtonMapper'); |
| 13 |
$this->menu_mapper = $this->createMock('ResponsiveMenu\Mappers\ScssMenuMapper'); |
| 14 |
$this->minifier = $this->createMock('ResponsiveMenu\Formatters\Minify'); |
| 15 |
|
| 16 |
$this->base_mapper->method('map')->willReturn('a'); |
| 17 |
$this->button_mapper->method('map')->willReturn('b'); |
| 18 |
$this->menu_mapper->method('map')->willReturn('c'); |
| 19 |
$this->minifier->method('minify')->willReturn('d'); |
| 20 |
$this->factory = new CssFactory($this->minifier, $this->base_mapper, $this->button_mapper, $this->menu_mapper); |
| 21 |
} |
| 22 |
|
| 23 |
public function testMinified() { |
| 24 |
$collection = new OptionsCollection; |
| 25 |
$collection->add(new Option('minify_scripts', 'on')); |
| 26 |
$this->assertequals('d', $this->factory->build($collection)); |
| 27 |
} |
| 28 |
|
| 29 |
public function testNotMinified() { |
| 30 |
$collection = new OptionsCollection; |
| 31 |
$collection->add(new Option('minify_scripts', 'off')); |
| 32 |
$this->assertequals('abc', $this->factory->build($collection)); |
| 33 |
} |
| 34 |
|
| 35 |
} |
| 36 |
|