Skip to content

Commit

Permalink
Fix CS issues failing Travis build
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Burke committed Nov 6, 2014
1 parent f5fa1ab commit 87907ee
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 15 deletions.
19 changes: 18 additions & 1 deletion Controller/BoostCakeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ class BoostCakeController extends AppController {
);

/**
* beforeFilter
* Before filter
*
* @throws MethodNotAllowedException
* @return void
*/
public function beforeFilter() {
if (Configure::read('debug') < 1) {
Expand All @@ -24,9 +26,19 @@ public function beforeFilter() {
parent::beforeFilter();
}

/**
* Action for plugin documentation home page
*
* @return void
*/
public function index() {
}

/**
* Action for Bootstrap 2 example page
*
* @return void
*/
public function bootstrap2() {
$this->Session->setFlash(__('Alert notice message testing...'), 'alert', array(
'plugin' => 'BoostCake',
Expand All @@ -41,6 +53,11 @@ public function bootstrap2() {
), 'error');
}

/**
* Action for Bootstrap 3 example page
*
* @return void
*/
public function bootstrap3() {
$this->Session->setFlash(__('Alert success message testing...'), 'alert', array(
'plugin' => 'BoostCake',
Expand Down
5 changes: 5 additions & 0 deletions Test/Case/AllBoostCakeTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?php
class AllBoostCakeTest extends CakeTestSuite {

/**
* Adds all tests to the AllBoostCakeTest case
*
* @return CakeTestSuite
*/
public static function suite() {
$suite = new CakeTestSuite('All tests');
$path = dirname(__FILE__);
Expand Down
50 changes: 50 additions & 0 deletions Test/Case/View/Helper/BoostCakeFormHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ class Contact extends CakeTestModel {

class BoostCakeFormHelperTest extends CakeTestCase {

/**
* setUp
*
* @return void
*/
public function setUp() {
parent::setUp();
$this->View = new View();
Expand All @@ -40,11 +45,21 @@ public function setUp() {
ClassRegistry::addObject('Contact', new Contact());
}

/**
* tearDown
*
* @return void
*/
public function tearDown() {
unset($this->View);
unset($this->Form);
}

/**
* testInput
*
* @return void
*/
public function testInput() {
$result = $this->Form->input('name');
$this->assertTags($result, array(
Expand Down Expand Up @@ -108,6 +123,11 @@ public function testInput() {
));
}

/**
* testBeforeInputAfterInput
*
* @return void
*/
public function testBeforeInputAfterInput() {
$result = $this->Form->input('name', array(
'beforeInput' => 'Before Input',
Expand All @@ -127,6 +147,11 @@ public function testBeforeInputAfterInput() {
));
}

/**
* testCheckbox
*
* @return void
*/
public function testCheckbox() {
$result = $this->Form->input('name', array('type' => 'checkbox'));
$this->assertTags($result, array(
Expand Down Expand Up @@ -179,6 +204,11 @@ public function testCheckbox() {
));
}

/**
* testCheckboxLabelEscape
*
* @return void
*/
public function testCheckboxLabelEscape() {
$result = $this->Form->input('name', array(
'type' => 'checkbox',
Expand All @@ -199,6 +229,11 @@ public function testCheckboxLabelEscape() {
));
}

/**
* testSelectMultipleCheckbox
*
* @return void
*/
public function testSelectMultipleCheckbox() {
$result = $this->Form->select('name',
array(
Expand Down Expand Up @@ -290,6 +325,11 @@ public function testSelectMultipleCheckbox() {
));
}

/**
* testRadio
*
* @return void
*/
public function testRadio() {
$result = $this->Form->input('name', array(
'type' => 'radio',
Expand Down Expand Up @@ -320,6 +360,11 @@ public function testRadio() {
));
}

/**
* testErrorMessage
*
* @return void
*/
public function testErrorMessage() {
$Contact = ClassRegistry::getObject('Contact');
$Contact->validationErrors['password'] = array('Please provide a password');
Expand Down Expand Up @@ -402,6 +447,11 @@ public function testErrorMessage() {
));
}

/**
* testPostLink
*
* @return void
*/
public function testPostLink() {
$result = $this->Form->postLink('Delete', '/posts/delete/1', array(
'block' => 'form'
Expand Down
20 changes: 20 additions & 0 deletions Test/Case/View/Helper/BoostCakeHtmlHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,31 @@

class BoostCakeHtmlHelperTest extends CakeTestCase {

/**
* setUp
*
* @return void
*/
public function setUp() {
parent::setUp();
$View = new View();
$this->Html = new BoostCakeHtmlHelper($View);
}

/**
* tearDown
*
* @return void
*/
public function tearDown() {
unset($this->Html);
}

/**
* testUseTag
*
* @return void
*/
public function testUseTag() {
$result = $this->Html->useTag(
'radio', 'one', 'two', array('three' => 'four'), '<label for="one">label</label>'
Expand All @@ -36,6 +51,11 @@ public function testUseTag() {
));
}

/**
* testImage
*
* @return void
*/
public function testImage() {
$result = $this->Html->image('', array('data-src' => 'holder.js/24x24'));
$this->assertTags($result, array(
Expand Down
32 changes: 18 additions & 14 deletions View/Helper/BoostCakeFormHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class BoostCakeFormHelper extends FormHelper {

/**
* Overwrite FormHelper::input()
* Generates a form input element complete with label and wrapper div
*
* - Generates a form input element complete with label and wrapper div
*
* ### Options
*
Expand Down Expand Up @@ -139,10 +140,11 @@ public function input($fieldName, $options = array()) {

/**
* Overwrite FormHelper::_divOptions()
* Generate inner and outer div options
* Generate div options for input
*
* @param array $options
* - Generate inner and outer div options
* - Generate div options for input
*
* @param array $options Options list.
* @return array
*/
protected function _divOptions($options) {
Expand All @@ -165,11 +167,12 @@ protected function _divOptions($options) {

/**
* Overwrite FormHelper::_getInput()
* Wrap `<div>` input element
* Generates an input element
*
* @param type $args
* @return type
* - Wrap `<div>` input element
* - Generates an input element
*
* @param array $args The options for the input element
* @return string The generated input element
*/
protected function _getInput($args) {
$input = parent::_getInput($args);
Expand Down Expand Up @@ -203,13 +206,14 @@ protected function _getInput($args) {

/**
* Overwrite FormHelper::_selectOptions()
* If $attributes['style'] is `<input type="checkbox">` then replace `<label>` position
* Returns an array of formatted OPTION/OPTGROUP elements
*
* @param array $elements
* @param array $parents
* @param boolean $showParents
* @param array $attributes
* - If $attributes['style'] is `<input type="checkbox">` then replace `<label>` position
* - Returns an array of formatted OPTION/OPTGROUP elements
*
* @param array $elements Elements to format.
* @param array $parents Parents for OPTGROUP.
* @param bool $showParents Whether to show parents.
* @param array $attributes HTML attributes.
* @return array
*/
protected function _selectOptions($elements = array(), $parents = array(), $showParents = null, $attributes = array()) {
Expand Down
50 changes: 50 additions & 0 deletions View/Helper/BoostCakePaginatorHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

class BoostCakePaginatorHelper extends PaginatorHelper {

/**
* Multi-page pagination component.
*
* @param array $options Pagination options.
* @return string Pagination HTML.
*/
public function pagination($options = array()) {
$default = array(
'div' => false,
Expand Down Expand Up @@ -47,6 +53,12 @@ public function pagination($options = array()) {
return $out;
}

/**
* Quick previous and next links for simple pagination.
*
* @param array $options Pager options.
* @return string Pager HTML.
*/
public function pager($options = array()) {
$default = array(
'ul' => 'pager',
Expand All @@ -70,6 +82,15 @@ public function pager($options = array()) {
return $this->Html->tag('ul', implode("\n", $out), compact('class'));
}

/**
* Generates a "previous" link for a set of paged records
*
* @param string $title Title for the link. Defaults to '<'.
* @param array $options Options for pagination link.
* @param string $disabledTitle Title when the link is disabled.
* @param array $disabledOptions Options for the disabled pagination link.
* @return string A "previous" link or $disabledTitle text if the link is disabled.
*/
public function prev($title = null, $options = array(), $disabledTitle = null, $disabledOptions = array()) {
$default = array(
'title' => '<',
Expand Down Expand Up @@ -104,6 +125,15 @@ public function prev($title = null, $options = array(), $disabledTitle = null, $
)));
}

/**
* Generates a "next" link for a set of paged records
*
* @param string $title Title for the link. Defaults to '>'.
* @param array $options Options for pagination link.
* @param string $disabledTitle Title when the link is disabled.
* @param array $disabledOptions Options for the disabled pagination link.
* @return string A "next" link or $disabledTitle text if the link is disabled.
*/
public function next($title = null, $options = array(), $disabledTitle = null, $disabledOptions = array()) {
$default = array(
'title' => '>',
Expand Down Expand Up @@ -138,6 +168,12 @@ public function next($title = null, $options = array(), $disabledTitle = null, $
)));
}

/**
* Returns a set of numbers for the paged result set
*
* @param array $options Options for the numbers
* @return string Numbers HTML
*/
public function numbers($options = array()) {
$defaults = array(
'tag' => 'li',
Expand All @@ -157,6 +193,13 @@ public function numbers($options = array()) {
return preg_replace('@<li class="current">(.*?)</li>@', '<li class="current disabled"><a href="#">\1</a></li>', $return);
}

/**
* Generates a "first" link for a set of paged records
*
* @param string $title Title for the link. Defaults to '<<'.
* @param array $options An array of options.
* @return string A "first" link.
*/
public function first($title = null, $options = array()) {
$default = array(
'title' => '<<',
Expand All @@ -180,6 +223,13 @@ public function first($title = null, $options = array()) {
);
}

/**
* Generates a "last" link for a set of paged records
*
* @param string $title Title for the link. Defaults to '>>'.
* @param array $options An array of options.
* @return string A "last" link.
*/
public function last($title = null, $options = array()) {
$default = array(
'title' => '>>',
Expand Down

0 comments on commit 87907ee

Please sign in to comment.