Skip to content

Commit

Permalink
Tidy up test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Feb 13, 2017
1 parent b138621 commit dbca5e2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
5 changes: 5 additions & 0 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -8502,6 +8502,7 @@ public function testNestedLabelInput()
*
* This test makes sure `false` excludes the label from the render
*
* @return void
*/
public function testInputLabelManipulationDisableLabels()
{
Expand Down Expand Up @@ -8556,6 +8557,8 @@ public function testInputLabelManipulationDisableLabels()
* added to the class if checked.
*
* Also checks to make sure any custom attributes are rendered correctly
*
* @return void
*/
public function testInputLabelManipulationRadios()
{
Expand Down Expand Up @@ -8664,6 +8667,8 @@ public function testInputLabelManipulationRadios()
* added to the class if checked.
*
* Also checks to make sure any custom attributes are rendered correctly
*
* @return void
*/
public function testInputLabelManipulationCheckboxes()
{
Expand Down
19 changes: 18 additions & 1 deletion tests/TestCase/View/StringTemplateTest.php
Expand Up @@ -305,18 +305,23 @@ public function testPushPopTemplates()
* Test addClass method newClass parameter
*
* Tests null, string, array and false for `input`
*
* @return void
*/
public function testAddClassMethodNewClass()
{
// Test new class as null, string, array, false etc
$result = $this->template->addClass([], 'new_class');
$this->assertEquals($result, ['class' => ['new_class']]);

$result = $this->template->addClass([], ['new_class']);
$this->assertEquals($result, ['class' => ['new_class']]);

$result = $this->template->addClass([], false);
$this->assertEquals($result, []);

$result = $this->template->addClass([], null);
$this->assertEquals($result, []);

$result = $this->template->addClass(null, null);
$this->assertNull($result);
}
Expand All @@ -325,23 +330,31 @@ public function testAddClassMethodNewClass()
* Test addClass method input (currentClass) parameter
*
* Tests null, string, array, false and object
*
* @return void
*/
public function testAddClassMethodCurrentClass()
{
$result = $this->template->addClass(['class' => ['current']], 'new_class');
$this->assertEquals($result, ['class' => ['current', 'new_class']]);

$result = $this->template->addClass('', 'new_class');
$this->assertEquals($result, ['class' => ['new_class']]);

$result = $this->template->addClass(null, 'new_class');
$this->assertEquals($result, ['class' => ['new_class']]);

$result = $this->template->addClass(false, 'new_class');
$this->assertEquals($result, ['class' => ['new_class']]);

$result = $this->template->addClass(new \StdClass(), 'new_class');
$this->assertEquals($result, ['class' => ['new_class']]);
}

/**
* Test addClass method string parameter, it should fallback to string
*
* @return void
*/
public function testAddClassMethodFallbackToString()
{
Expand All @@ -351,6 +364,8 @@ public function testAddClassMethodFallbackToString()

/**
* Test addClass method to make sure the returned array is unique
*
* @return void
*/
public function testAddClassMethodUnique()
{
Expand All @@ -362,6 +377,8 @@ public function testAddClassMethodUnique()
* Test addClass method useIndex param
*
* Tests for useIndex being the default, 'my_class' and false
*
* @return void
*/
public function testAddClassMethodUseIndex()
{
Expand Down

0 comments on commit dbca5e2

Please sign in to comment.