This repository has been archived by the owner on Nov 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated test class for
Zepto\Zepto
and added new test class for `…
…`Zepto\Helper``
- Loading branch information
1 parent
f3b469a
commit fa880ec
Showing
3 changed files
with
181 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
<?php | ||
namespace Zepto; | ||
|
||
/** | ||
* Generated by PHPUnit_SkeletonGenerator 1.2.1 on 2014-02-12 at 20:07:01. | ||
*/ | ||
class HelperTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var Helper | ||
*/ | ||
protected $helper; | ||
|
||
/** | ||
* Sets up the fixture, for example, opens a network connection. | ||
* This method is called before a test is executed. | ||
*/ | ||
protected function setUp() | ||
{ | ||
// $zepto = new Zepto; | ||
// $this->helper = new Helper($zepto->app); | ||
} | ||
|
||
/** | ||
* Tears down the fixture, for example, closes a network connection. | ||
* This method is called after a test is executed. | ||
*/ | ||
protected function tearDown() | ||
{ | ||
} | ||
|
||
/** | ||
* @covers Zepto\Helper::default_config | ||
*/ | ||
public function testDefaultConfig() | ||
{ | ||
$expected = array( | ||
'zepto' => array( | ||
'environment' => 'dev', | ||
'content_dir' => 'content', | ||
'plugins_dir' => 'plugins', | ||
'templates_dir' => 'templates', | ||
'default_template' => 'base.twig', | ||
'content_ext' => array('.md', '.markdown'), | ||
'plugins_enabled' => true | ||
), | ||
'site' => array( | ||
'site_root' => 'http://localhost:8888/zepto/', | ||
'site_title' => 'Zepto', | ||
'date_format' => 'jS M Y', | ||
'excerpt_length' => '50', | ||
'nav' => array( | ||
'class' => 'nav', | ||
'dropdown_li_class' => 'dropdown', | ||
'dropdown_ul_class' => 'dropdown-menu' | ||
) | ||
), | ||
'twig' => array( | ||
'charset' => 'utf-8', | ||
'cache' => 'cache', | ||
'strict_variables' => false, | ||
'autoescape' => false, | ||
'auto_reload' => true | ||
) | ||
); | ||
$this->assertEquals($expected, Helper::default_config()); | ||
} | ||
|
||
/** | ||
* @covers Zepto\Helper::validate_config() | ||
*/ | ||
public function testValidateConfig() | ||
{ | ||
ob_start(); | ||
$config = Helper::default_config(); | ||
$this->assertTrue(Helper::validate_config($config)); | ||
} | ||
|
||
/** | ||
* @covers Zepto\Helper::validate_config() | ||
* @expectedException InvalidArgumentException | ||
*/ | ||
public function testConfigWithInvalidContentDir() | ||
{ | ||
ob_start(); | ||
$config = Helper::default_config(); | ||
$config['zepto']['content_dir'] = 'no_such_dir'; | ||
Helper::validate_config($config); | ||
} | ||
|
||
/** | ||
* @covers Zepto\Helper::validate_config() | ||
* @expectedException InvalidArgumentException | ||
*/ | ||
public function testConfigWithInvalidPluginsDir() | ||
{ | ||
ob_start(); | ||
$config = Helper::default_config(); | ||
$config['zepto']['plugins_dir'] = 'no_such_dir'; | ||
Helper::validate_config($config); | ||
} | ||
|
||
/** | ||
* @covers Zepto\Helper::validate_config() | ||
* @expectedException InvalidArgumentException | ||
*/ | ||
public function testConfigWithInvalidTemplatesDir() | ||
{ | ||
ob_start(); | ||
$config = Helper::default_config(); | ||
$config['zepto']['templates_dir'] = 'no_such_dir'; | ||
Helper::validate_config($config); | ||
} | ||
|
||
/** | ||
* @covers Zepto\Helper::validate_config() | ||
* @expectedException InvalidArgumentException | ||
*/ | ||
public function testConfigWithInvalidDefaultTemplate() | ||
{ | ||
ob_start(); | ||
$config = Helper::default_config(); | ||
$config['zepto']['default_template'] = 'no_such_file'; | ||
Helper::validate_config($config); | ||
} | ||
|
||
/** | ||
* @covers Zepto\Helper::validate_config() | ||
* @expectedException InvalidArgumentException | ||
*/ | ||
public function testConfigWithInvalidSiteRoot() | ||
{ | ||
ob_start(); | ||
$config = Helper::default_config(); | ||
$config['zepto']['environment'] = 'production'; | ||
$config['site']['site_root'] = 'fuck://this@should?fail'; | ||
Helper::validate_config($config); | ||
} | ||
|
||
/** | ||
* @covers Zepto\Helper::url_for | ||
* @todo Implement testUrl_for(). | ||
*/ | ||
public function testUrl_for() | ||
{ | ||
// Remove the following lines when you implement this test. | ||
$this->markTestIncomplete( | ||
'This test has not been implemented yet.' | ||
); | ||
} | ||
|
||
/** | ||
* @covers Zepto\Helper::link_for | ||
* @todo Implement testLink_for(). | ||
*/ | ||
public function testLink_for() | ||
{ | ||
// Remove the following lines when you implement this test. | ||
$this->markTestIncomplete( | ||
'This test has not been implemented yet.' | ||
); | ||
} | ||
} |
Oops, something went wrong.