浏览代码

Merge pull request #10112 from lilHermit/fixes/tests-formhelpertest

General clean up
Mark Story 9 年之前
父节点
当前提交
83f0fea9f8
共有 1 个文件被更改,包括 10 次插入12 次删除
  1. 10 12
      tests/TestCase/View/Helper/FormHelperTest.php

+ 10 - 12
tests/TestCase/View/Helper/FormHelperTest.php

@@ -400,7 +400,6 @@ class FormHelperTest extends TestCase
         $entity = new Article();
         $collection = new Collection([$entity]);
         $emptyCollection = new Collection([]);
-        $emptyArray = [];
         $arrayObject = new \ArrayObject([]);
         $data = [
             'schema' => [
@@ -896,7 +895,7 @@ class FormHelperTest extends TestCase
      * Test base form URL when url param is passed with multiple parameters (&)
      *
      */
-    public function testCreateQuerystringrequest()
+    public function testCreateQueryStringRequest()
     {
         $encoding = strtolower(Configure::read('App.encoding'));
         $result = $this->Form->create($this->article, [
@@ -1087,7 +1086,6 @@ class FormHelperTest extends TestCase
     public function testCreateEndGetNoSecurity()
     {
         $this->Form->request->params['_csrfToken'] = 'testKey';
-        $encoding = strtolower(Configure::read('App.encoding'));
         $article = new Article();
         $result = $this->Form->create($article, [
             'type' => 'get',
@@ -1471,7 +1469,6 @@ class FormHelperTest extends TestCase
      */
     public function testSecuritySubmitImageNoName()
     {
-        $key = 'testKey';
         $this->Form->request->params['_Token'] = 'testKey';
 
         $this->Form->create(false);
@@ -2406,18 +2403,18 @@ class FormHelperTest extends TestCase
     }
 
     /**
-     * testSecuredFormUrlHasHtmlAndIdentifer method
+     * testSecuredFormUrlHasHtmlAndIdentifier method
      *
-     * Test that URL, HTML and identifer show up in their hashs.
+     * Test that URL, HTML and identifier show up in their hashes.
      *
      * @return void
      */
-    public function testSecuredFormUrlHasHtmlAndIdentifer()
+    public function testSecuredFormUrlHasHtmlAndIdentifier()
     {
         $this->Form->request['_Token'] = ['key' => 'testKey'];
 
         $expected = 'ece0693fb1b19ca116133db1832ac29baaf41ce5%3A';
-        $res = $this->Form->create($this->article, [
+        $this->Form->create($this->article, [
             'url' => [
                 'controller' => 'articles',
                 'action' => 'view',
@@ -3066,6 +3063,7 @@ class FormHelperTest extends TestCase
                 'type' => 'text', 'name' => 'nested[text][]'
             ],
         ];
+        $this->assertHtml($expected, $result);
 
         $result = $this->Form->file('nested.file[]');
         $expected = [
@@ -5408,7 +5406,7 @@ class FormHelperTest extends TestCase
         $this->Form->request->params['_Token'] = 'testKey';
         $this->assertEquals([], $this->Form->fields);
 
-        $result = $this->Form->select(
+        $this->Form->select(
             'Model.multi_field',
             ['1' => 'first', '2' => 'second', '3' => 'third'],
             ['multiple' => 'checkbox']
@@ -5593,6 +5591,8 @@ class FormHelperTest extends TestCase
             new Collection(['1', '2']),
             ['name' => 'fish']
         );
+        $this->assertHtml($expected, $result);
+
         $result = $this->Form->multiCheckbox('category', ['1', '2'], [
             'name' => 'fish',
         ]);
@@ -6043,7 +6043,6 @@ class FormHelperTest extends TestCase
     public function testDatetimeEmpty()
     {
         extract($this->dateRegex);
-        $now = strtotime('now');
 
         $result = $this->Form->dateTime('Contact.date', [
             'timeFormat' => 12,
@@ -6101,7 +6100,6 @@ class FormHelperTest extends TestCase
     public function testDatetimeMinuteInterval()
     {
         extract($this->dateRegex);
-        $now = strtotime('now');
 
         $result = $this->Form->dateTime('Contact.date', [
             'interval' => 5,
@@ -7867,7 +7865,7 @@ class FormHelperTest extends TestCase
      */
     public function testForMagicInputNonExistingNorValidated()
     {
-        $result = $this->Form->create($this->article);
+        $this->Form->create($this->article);
         $this->Form->templates(['inputContainer' => '{{content}}']);
         $result = $this->Form->input('non_existing_nor_validated');
         $expected = [