Skip to content

Commit

Permalink
Merge pull request #12 from madapaja/pr-for-1.0.0
Browse files Browse the repository at this point in the history
PR for 1.0.0
  • Loading branch information
koriym committed May 26, 2015
2 parents 29e18e6 + 16099b8 commit 990bc93
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ language: php
php:
- 5.5
- 5.6
- 7.0
- hhvm

before_install:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ or to modify your `composer.json` and `composer update` command:
```json
{
"require": {
"madapaja/twig-module": "~0.2"
"madapaja/twig-module": "~1.0"
}
}
```
Expand Down
7 changes: 1 addition & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,5 @@
}
},
"prefer-stable": true,
"minimum-stability": "dev",
"extra": {
"branch-alias": {
"dev-master": "0.3.x-dev"
}
}
"minimum-stability": "dev"
}
9 changes: 9 additions & 0 deletions tests/MobileTemplateFinderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@ public function testMobileTemplate()
$expected = $_ENV['TEST_DIR'] . '/Resource/Page/Index.mobile.twig';
$this->assertSame($expected, $file);
}

public function testPcTemplate()
{
$pc = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)';
$templateFinder = new MobileTemplateFinder($pc);
$file = $templateFinder->__invoke($_ENV['TEST_DIR'] . '/Resource/Page/Index.php', $pc);
$expected = $_ENV['TEST_DIR'] . '/Resource/Page/Index.html.twig';
$this->assertSame($expected, $file);
}
}
11 changes: 11 additions & 0 deletions tests/Resource/Page/FileLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Madapaja\TwigModule\Resource\Page;

use BEAR\Resource\Code;
use Madapaja\TwigModule\TwigFileLoaderTestModule;
use Madapaja\TwigModule\TwigRenderer;
use PHPUnit_Framework_TestCase;
Expand Down Expand Up @@ -63,6 +64,16 @@ public function testNoViewWhenCode301()
$this->assertSame('', $view);
}

public function testNoContent()
{
$ro = $this->injector->getInstance(NoTemplate::class);
$ro->code = Code::NO_CONTENT;
$prop = (new \ReflectionClass($ro))->getProperty('renderer');
$prop->setAccessible(true);
$view = $prop->getValue($ro)->render($ro);
$this->assertSame('', $view);
}

public function testPage()
{
$ro = $this->injector->getInstance(Page::class);
Expand Down

0 comments on commit 990bc93

Please sign in to comment.