diff --git a/tests/uts/dbFormhandler_BaseTest.php b/tests/uts/dbFormhandler_BaseTest.php index dc87c32..b88094a 100644 --- a/tests/uts/dbFormhandler_BaseTest.php +++ b/tests/uts/dbFormhandler_BaseTest.php @@ -8,33 +8,33 @@ public function testConstructor(): void { $form = new dbFormHandler(); - $this->assertInstanceOf("dbFormHandler", $form); + static::assertInstanceOf("dbFormHandler", $form); $_sql = $this->getPrivateProperty($form, '_sql'); - $this->assertTrue(is_array($_sql)); - $this->assertEquals(0, sizeof($_sql)); + static::assertTrue(is_array($_sql)); + static::assertEquals(0, sizeof($_sql)); $_dbData = $this->getPrivateProperty($form, '_dbData'); - $this->assertTrue(is_array($_dbData)); - $this->assertEquals(0, sizeof($_dbData)); + static::assertTrue(is_array($_dbData)); + static::assertEquals(0, sizeof($_dbData)); $_dontSave = $this->getPrivateProperty($form, '_dontSave'); - $this->assertTrue(is_array($_dontSave)); - $this->assertEquals(0, sizeof($_dontSave)); + static::assertTrue(is_array($_dontSave)); + static::assertEquals(0, sizeof($_dontSave)); $_id = $this->getPrivateProperty($form, '_id'); - $this->assertTrue(is_array($_id)); - $this->assertEquals(0, sizeof($_id)); + static::assertTrue(is_array($_id)); + static::assertEquals(0, sizeof($_id)); $dieOnQuery = $this->getPrivateProperty($form, 'dieOnQuery'); - $this->assertFalse($dieOnQuery); + static::assertFalse($dieOnQuery); $_editName = $this->getPrivateProperty($form, '_editName'); - $this->assertEquals("id", $_editName); + static::assertEquals("id", $_editName); - $this->assertTrue($form->insert); - $this->assertFalse($form->edit); - $this->assertFalse($form->isPosted()); + static::assertTrue($form->insert); + static::assertFalse($form->edit); + static::assertFalse($form->isPosted()); } public function test_SetConnectionResource(): void @@ -44,12 +44,12 @@ public function test_SetConnectionResource(): void $this->setConnectedTable($form, "test"); $_db = $this->getPrivateProperty($form, '_db'); - $this->assertInstanceOf("YadalDibi", $_db); + static::assertInstanceOf("YadalDibi", $_db); - $this->assertTrue($_db->isConnected()); - $this->assertTrue($_db->_quoteNumbers); + static::assertTrue($_db->isConnected()); + static::assertTrue($_db->_quoteNumbers); $_table = $this->getPrivateProperty($form, '_table'); - $this->assertEquals("test", $_table); + static::assertEquals("test", $_table); } }; diff --git a/tests/uts/dbFormhandler_PassFieldTest.php b/tests/uts/dbFormhandler_PassFieldTest.php index 421d69b..14a8abf 100644 --- a/tests/uts/dbFormhandler_PassFieldTest.php +++ b/tests/uts/dbFormhandler_PassFieldTest.php @@ -10,19 +10,19 @@ public function test_new(): void $form = new dbFormHandler(); - $this->assertTrue($form->insert); - $this->assertFalse($form->edit); - $this->assertFalse($form->isPosted()); + static::assertTrue($form->insert); + static::assertFalse($form->edit); + static::assertFalse($form->isPosted()); $this->setConnectedTable($form, "test"); $form->passField("Your password", "pass", FH_PASSWORD); $form->textField("TextNullable", "textNullable"); - $this->assertEmpty($form->getValue("textNullable")); - $this->assertEmpty($form->getValue("textNotNullable")); + static::assertEmpty($form->getValue("textNullable")); + static::assertEmpty($form->getValue("textNotNullable")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Your password:error_pass', 'TextNullable:error_textNullable' ]); @@ -36,9 +36,9 @@ public function test_edit(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertFalse($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -52,10 +52,10 @@ public function test_edit(): void $form->passField("Your password", "pass", FH_PASSWORD); $form->textField("TextNullable", "textNullable"); - $this->assertEquals("text1", $form->getValue("textNullable")); - $this->assertEquals("secret", $form->getValue("pass")); + static::assertEquals("text1", $form->getValue("textNullable")); + static::assertEquals("secret", $form->getValue("pass")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Your password:error_pass', 'TextNullable:error_textNullable' ]); @@ -67,9 +67,9 @@ public function test_insert_noValues(): void $form = new dbFormHandler(); - $this->assertTrue($form->insert); - $this->assertFalse($form->edit); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->insert); + static::assertFalse($form->edit); + static::assertTrue($form->isPosted()); $this->setConnectedTable($form, "test"); @@ -78,7 +78,7 @@ public function test_insert_noValues(): void $e = $form->catchErrors(); $expected = "You did not enter a correct value for this field!"; - $this->assertStringContainsString($expected, $e['pass']); + static::assertStringContainsString($expected, $e['pass']); } public function test_insert(): void @@ -91,9 +91,9 @@ public function test_insert(): void $form = new dbFormHandler(); - $this->assertTrue($form->insert); - $this->assertFalse($form->edit); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->insert); + static::assertFalse($form->edit); + static::assertTrue($form->isPosted()); $this->setConnectedTable($form, "test"); @@ -111,7 +111,7 @@ public function test_insert(): void $r = $form->flush(true); - $this->assertEmpty($r); + static::assertEmpty($r); $this->assertSavedId(4711); $this->assertSavedValue('secret', 'pass'); $this->assertSavedValue('thetext', 'textNullable'); @@ -126,8 +126,8 @@ public function test_insert(): void // $form = new dbFormHandler(); - // $this->assertFalse($form->insert); - // $this->assertTrue($form->edit); + // static::assertFalse($form->insert); + // static::assertTrue($form->edit); // $this->getDatabaseMock() // ->expects($this->exactly(1)) @@ -149,9 +149,9 @@ public function test_insert(): void // $r = $form->flush(true); - // $this->fail("forced failure: empty pass fails"); + // static::fail("forced failure: empty pass fails"); - // $this->assertEquals("", $r); + // static::assertEquals("", $r); // $this->assertSavedId(4714); // $this->assertSavedValueEmtpy('textNullable'); // } @@ -166,9 +166,9 @@ public function test_update(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertTrue($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertTrue($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -190,7 +190,7 @@ public function test_update(): void $r = $form->flush(true); - $this->assertEmpty($r); + static::assertEmpty($r); $this->assertSavedId(4715); $this->assertSavedValue("newpass", "pass"); } diff --git a/tests/uts/dbFormhandler_TextFieldTest.php b/tests/uts/dbFormhandler_TextFieldTest.php index cc4dc0e..a9a2229 100644 --- a/tests/uts/dbFormhandler_TextFieldTest.php +++ b/tests/uts/dbFormhandler_TextFieldTest.php @@ -10,19 +10,19 @@ public function test_new(): void $form = new dbFormHandler(); - $this->assertTrue($form->insert); - $this->assertFalse($form->edit); - $this->assertFalse($form->isPosted()); + static::assertTrue($form->insert); + static::assertFalse($form->edit); + static::assertFalse($form->isPosted()); $this->setConnectedTable($form, "test"); $form->textField("TextNullable", "textNullable"); $form->textField("TextNotNullable", "textNotNullable"); - $this->assertEmpty($form->getValue("textNullable")); - $this->assertEmpty($form->getValue("textNotNullable")); + static::assertEmpty($form->getValue("textNullable")); + static::assertEmpty($form->getValue("textNotNullable")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'input type="text" name="textNullable" id="textNullable" value=""', 'input type="text" name="textNotNullable" id="textNotNullable" value=""' ]); @@ -36,9 +36,9 @@ public function test_edit_noDataset(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertFalse($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -57,9 +57,9 @@ public function test_edit(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertFalse($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -73,10 +73,10 @@ public function test_edit(): void $form->textField("TextNullable", "textNullable"); $form->textField("TextNotNullable", "textNotNullable"); - $this->assertEquals("text1", $form->getValue("textNullable")); - $this->assertEquals("text2", $form->getValue("textNotNullable")); + static::assertEquals("text1", $form->getValue("textNullable")); + static::assertEquals("text2", $form->getValue("textNotNullable")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'input type="text" name="textNullable" id="textNullable" value="text1"', 'input type="text" name="textNotNullable" id="textNotNullable" value="text2"' ]); @@ -90,9 +90,9 @@ public function test_insert_noValues(): void $form = new dbFormHandler(); - $this->assertTrue($form->insert); - $this->assertFalse($form->edit); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->insert); + static::assertFalse($form->edit); + static::assertTrue($form->isPosted()); $this->setConnectedTable($form, "test"); @@ -109,7 +109,7 @@ public function test_insert_noValues(): void $r = $form->flush(true); - $this->assertEmpty($r); + static::assertEmpty($r); $this->assertSavedId(4712); $this->assertSavedValueEmtpy('textNullable'); $this->assertSavedValueEmtpy('textNotNullable'); @@ -125,9 +125,9 @@ public function test_insert(): void $form = new dbFormHandler(); - $this->assertTrue($form->insert); - $this->assertFalse($form->edit); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->insert); + static::assertFalse($form->edit); + static::assertTrue($form->isPosted()); $this->setConnectedTable($form, "test"); @@ -144,7 +144,7 @@ public function test_insert(): void $r = $form->flush(true); - $this->assertEmpty($r); + static::assertEmpty($r); $this->assertSavedId(4713); $this->assertSavedValue('thetext', 'textNullable'); $this->assertSavedValue('anothertext', 'textNotNullable'); @@ -159,9 +159,9 @@ public function test_update_noValues(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertTrue($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertTrue($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -183,7 +183,7 @@ public function test_update_noValues(): void $r = $form->flush(true); - $this->assertEmpty($r); + static::assertEmpty($r); $this->assertSavedId(4714); $this->assertSavedValueEmtpy('textNullable'); $this->assertSavedValueEmtpy('textNotNullable'); @@ -200,9 +200,9 @@ public function test_update(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertTrue($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertTrue($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -223,7 +223,7 @@ public function test_update(): void $r = $form->flush(true); - $this->assertEmpty($r); + static::assertEmpty($r); $this->assertSavedId(4715); $this->assertSavedValue('thetext', 'textNullable'); $this->assertSavedValue('anothertext', 'textNotNullable'); diff --git a/tests/uts/dbFormhandler_dbListFieldTest.php b/tests/uts/dbFormhandler_dbListFieldTest.php index 95c93a7..e3e4672 100644 --- a/tests/uts/dbFormhandler_dbListFieldTest.php +++ b/tests/uts/dbFormhandler_dbListFieldTest.php @@ -10,19 +10,19 @@ public function test_new(): void $form = new dbFormHandler(); - $this->assertTrue($form->insert); - $this->assertFalse($form->edit); - $this->assertFalse($form->isPosted()); + static::assertTrue($form->insert); + static::assertFalse($form->edit); + static::assertFalse($form->isPosted()); $this->setConnectedTable($form, "test"); $form->textField("TextNullable", "textNullable"); $form->textField("TextNotNullable", "textNotNullable"); - $this->assertEmpty($form->getValue("textNullable")); - $this->assertEmpty($form->getValue("textNotNullable")); + static::assertEmpty($form->getValue("textNullable")); + static::assertEmpty($form->getValue("textNotNullable")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'input type="text" name="textNullable" id="textNullable" value=""', 'input type="text" name="textNotNullable" id="textNotNullable" value=""' ]); @@ -36,9 +36,9 @@ public function test_edit_noDataset(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertFalse($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -57,9 +57,9 @@ public function test_edit(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertFalse($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -73,10 +73,10 @@ public function test_edit(): void $form->textField("TextNullable", "textNullable"); $form->textField("TextNotNullable", "textNotNullable"); - $this->assertEquals("text1", $form->getValue("textNullable")); - $this->assertEquals("text2", $form->getValue("textNotNullable")); + static::assertEquals("text1", $form->getValue("textNullable")); + static::assertEquals("text2", $form->getValue("textNotNullable")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'input type="text" name="textNullable" id="textNullable" value="text1"', 'input type="text" name="textNotNullable" id="textNotNullable" value="text2"' ]); @@ -90,9 +90,9 @@ public function test_insert_noValues(): void $form = new dbFormHandler(); - $this->assertTrue($form->insert); - $this->assertFalse($form->edit); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->insert); + static::assertFalse($form->edit); + static::assertTrue($form->isPosted()); $this->setConnectedTable($form, "test"); @@ -109,7 +109,7 @@ public function test_insert_noValues(): void $r = $form->flush(true); - $this->assertEmpty($r); + static::assertEmpty($r); $this->assertSavedId(4712); $this->assertSavedValueEmtpy('textNullable'); $this->assertSavedValueEmtpy('textNotNullable'); @@ -125,9 +125,9 @@ public function test_insert(): void $form = new dbFormHandler(); - $this->assertTrue($form->insert); - $this->assertFalse($form->edit); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->insert); + static::assertFalse($form->edit); + static::assertTrue($form->isPosted()); $this->setConnectedTable($form, "test"); @@ -144,7 +144,7 @@ public function test_insert(): void $r = $form->flush(true); - $this->assertEmpty($r); + static::assertEmpty($r); $this->assertSavedId(4713); $this->assertSavedValue('thetext', 'textNullable'); $this->assertSavedValue('anothertext', 'textNotNullable'); @@ -159,9 +159,9 @@ public function test_update_noValues(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertTrue($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertTrue($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -183,7 +183,7 @@ public function test_update_noValues(): void $r = $form->flush(true); - $this->assertEmpty($r); + static::assertEmpty($r); $this->assertSavedId(4714); $this->assertSavedValueEmtpy('textNullable'); $this->assertSavedValueEmtpy('textNotNullable'); @@ -200,9 +200,9 @@ public function test_update(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertTrue($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertTrue($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -223,7 +223,7 @@ public function test_update(): void $r = $form->flush(true); - $this->assertEmpty($r); + static::assertEmpty($r); $this->assertSavedId(4715); $this->assertSavedValue('thetext', 'textNullable'); $this->assertSavedValue('anothertext', 'textNotNullable'); diff --git a/tests/uts/dbFormhandler_dbSelectFieldTest.php b/tests/uts/dbFormhandler_dbSelectFieldTest.php index 5628d50..b17fafe 100644 --- a/tests/uts/dbFormhandler_dbSelectFieldTest.php +++ b/tests/uts/dbFormhandler_dbSelectFieldTest.php @@ -34,7 +34,7 @@ public function test_new(): void 'error_saveInField' ]; - $this->assertFormFlushContains($form, $aExpected); + static::assertFormFlushContains($form, $aExpected); } public function test_edit(): void @@ -45,9 +45,9 @@ public function test_edit(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertFalse($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -75,7 +75,7 @@ public function test_edit(): void FH_NOT_EMPTY ); - $this->assertEquals("2", $form->getValue("saveInField")); + static::assertEquals("2", $form->getValue("saveInField")); $aExpected = [ 'Options from a table:error_saveInField' ]; - $a = $this->assertFormFlushContains($form, $aExpected); + $a = static::assertFormFlushContains($form, $aExpected); } public function test_insert(): void @@ -97,7 +97,7 @@ public function test_insert(): void $this->setConnectedTable($form, "test"); $this->createMocksForTable(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $this->getDatabaseMock() ->expects($this->once()) @@ -127,7 +127,7 @@ public function test_insert(): void $r = $form->flush(true); - $this->assertEquals("", $r); + static::assertEquals("", $r); $this->assertSavedId(4711); $this->assertSavedValue('2', 'saveInField'); } @@ -172,11 +172,11 @@ public function test_insert(): void // $r = $form->flush(true); - // $this->assertEquals("", $r); + // static::assertEquals("", $r); // $this->assertSavedId(4711); // $this->assertSavedValue('3', 'saveInField'); - // $this->fail("forced failure: wrong value will be saved. 3 is not in list."); + // static::fail("forced failure: wrong value will be saved. 3 is not in list."); // } public function test_update(): void @@ -189,9 +189,9 @@ public function test_update(): void $form = new dbFormHandler(); - $this->assertFalse($form->insert); - $this->assertTrue($form->edit); - $this->assertTrue($form->isPosted()); + static::assertFalse($form->insert); + static::assertTrue($form->edit); + static::assertTrue($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -230,7 +230,7 @@ public function test_update(): void $r = $form->flush(true); - $this->assertEquals("", $r); + static::assertEquals("", $r); $this->assertSavedId(123); $this->assertSavedValue('2', 'saveInField'); } @@ -240,7 +240,7 @@ public function test_multiple_new(): void $form = new dbFormHandler(); $this->setConnectedTable($form, "test"); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $this->getDatabaseMock() ->expects($this->once()) @@ -267,7 +267,7 @@ public function test_multiple_new(): void 'error_saveInFieldString' ]; - $this->assertFormFlushContains($form, $aExpected); + static::assertFormFlushContains($form, $aExpected); } // public function test_multiple_edit(): void @@ -278,8 +278,8 @@ public function test_multiple_new(): void // $form = new dbFormHandler(); - // $this->assertFalse($form->insert); - // $this->assertTrue($form->edit); + // static::assertFalse($form->insert); + // static::assertTrue($form->edit); // $this->getDatabaseMock() // ->expects($this->exactly(1)) @@ -308,7 +308,7 @@ public function test_multiple_new(): void // true // ); - // $this->assertEquals(['0' => "2", '1' => " 1"], $form->getValue("saveInFieldString")); + // static::assertEquals(['0' => "2", '1' => " 1"], $form->getValue("saveInFieldString")); // $aExpected = [ // 'Options from a table:error_saveInFieldString' // ]; - // $a = $this->assertFormFlushContains($form, $aExpected); + // $a = static::assertFormFlushContains($form, $aExpected); - // $this->fail("forced failure: getValue has to deliver trimmed values, not ' 1'"); + // static::fail("forced failure: getValue has to deliver trimmed values, not ' 1'"); // } public function test_multiple_insert(): void @@ -329,7 +329,7 @@ public function test_multiple_insert(): void $form = new dbFormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $this->setConnectedTable($form, "test"); $this->createMocksForTable(); @@ -362,7 +362,7 @@ public function test_multiple_insert(): void $r = $form->flush(true); - $this->assertEquals("", $r); + static::assertEquals("", $r); $this->assertSavedId(4711); $this->assertSavedValue(['0' => "2", '1' => "1"], 'saveInFieldString'); } @@ -376,7 +376,7 @@ public function test_multiple_update(): void $form = new dbFormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $this->getDatabaseMock() ->expects($this->exactly(1)) @@ -415,7 +415,7 @@ public function test_multiple_update(): void $r = $form->flush(true); - $this->assertEquals("", $r); + static::assertEquals("", $r); $this->assertSavedId(123); $this->assertSavedValue(['0' => "2"], 'saveInFieldString'); } diff --git a/tests/uts/formhandler_AutocompleteTest.php b/tests/uts/formhandler_AutocompleteTest.php index 461dca5..526946b 100644 --- a/tests/uts/formhandler_AutocompleteTest.php +++ b/tests/uts/formhandler_AutocompleteTest.php @@ -14,7 +14,7 @@ public function test_show(): void $form->setAutoComplete("textfield", $aOptions); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/js/autocomplete.js', 'textfield_values = ["first", "second", "third"];', 'Textfield:error_textfield' @@ -53,7 +53,7 @@ public function test_after_show(): void $form->setAutoCompleteAfter("textfield", "@", $aOptions); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/js/autocomplete.js', 'textfield_values = ["first", "second", "third"];', 'Textfield:error_textfield' diff --git a/tests/uts/formhandler_BrowserFieldTest.php b/tests/uts/formhandler_BrowserFieldTest.php index 4952e33..ff64c5b 100644 --- a/tests/uts/formhandler_BrowserFieldTest.php +++ b/tests/uts/formhandler_BrowserFieldTest.php @@ -10,7 +10,7 @@ public function test_new(): void $form->browserField("BrowserField", "browserfield", "a/path"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'BrowserField: error_browserfield' @@ -24,7 +24,7 @@ public function test_viewmode(): void $form->browserField("BrowserField", "browserfield", "a/path"); $form->setFieldViewMode("browserfield"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'BrowserField:error_browserfield' ]); } @@ -38,9 +38,9 @@ public function test_posted(): void $form->browserField("BrowserField", "browserfield", "a/path"); - $this->assertEquals("o1", $form->getValue("browserfield")); + static::assertEquals("o1", $form->getValue("browserfield")); - $this->assertTrue($form->isCorrect()); + static::assertTrue($form->isCorrect()); } diff --git a/tests/uts/formhandler_ButtonsTest.php b/tests/uts/formhandler_ButtonsTest.php index a677da2..118513c 100644 --- a/tests/uts/formhandler_ButtonsTest.php +++ b/tests/uts/formhandler_ButtonsTest.php @@ -12,7 +12,7 @@ public function test_button(): void $form->button("Button2", "button4711"); $form->button("Button3", null, 'data-old="123"'); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'error_button1', 'error_button4711', 'error_button2' @@ -29,7 +29,7 @@ public function test_button_setIndex(): void $form->setTabIndex(array("but2", "but1", "but3")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'error_but1', 'error_but2', 'error_but3' @@ -46,7 +46,7 @@ public function test_submitButtom(): void $form->submitButton(null, null, 'data-old="123"'); $form->submitButton(null, null, null, false); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'error_button1', 'error_button2', 'error_submitbutton', @@ -61,7 +61,7 @@ public function test_submitButtom_onClick(): void $form->submitButton("Caption", "submitbutton", "onClick='doIt()'"); - $this->assertFormFlushContains($form, ['error_submitbutton']); + static::assertFormFlushContains($form, ['error_submitbutton']); } public function test_imageButton(): void @@ -72,7 +72,7 @@ public function test_imageButton(): void $form->imageButton("image.gif", "imagebutton"); $form->imageButton("image.gif", null, 'data-old="123"'); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'error_button1', 'error_imagebutton', 'error_button2' @@ -88,7 +88,7 @@ public function test_resetButton(): void $form->resetButton(null, "resetbutton"); $form->resetButton(null, null, 'data-old="123"'); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'error_button1', 'error_button2', 'error_resetbutton', @@ -106,7 +106,7 @@ public function test_cancelButton(): void $form->cancelButton(null, null, "cancelbutton"); $form->cancelButton(null, null, null, 'data-old="123"'); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'error_button1', 'error_button2', 'error_button3', @@ -124,7 +124,7 @@ public function test_backButton(): void $form->backButton(null, "backbutton"); $form->backButton(null, null, 'data-old="123"'); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'error_button1', 'error_button2', 'error_backbutton', diff --git a/tests/uts/formhandler_CaptchaFieldTest.php b/tests/uts/formhandler_CaptchaFieldTest.php index b8bf472..75433c0 100644 --- a/tests/uts/formhandler_CaptchaFieldTest.php +++ b/tests/uts/formhandler_CaptchaFieldTest.php @@ -8,13 +8,13 @@ public function test_new(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->CaptchaField("Captchafield", "captchafield"); - $this->assertEmpty($form->getValue("captchafield")); + static::assertEmpty($form->getValue("captchafield")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'error_button1Captchafield:error_captchafield' @@ -28,15 +28,15 @@ public function test_posted(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->CaptchaField("Captchafield", "captchafield"); - $this->assertFalse($form->isCorrect()); + static::assertFalse($form->isCorrect()); $t = $form->catchErrors(false); - $this->assertEquals( + static::assertEquals( 'You did not enter a correct value for this field!', $t['captchafield'] ); diff --git a/tests/uts/formhandler_CheckboxTest.php b/tests/uts/formhandler_CheckboxTest.php index 631c1de..c354529 100644 --- a/tests/uts/formhandler_CheckboxTest.php +++ b/tests/uts/formhandler_CheckboxTest.php @@ -14,50 +14,50 @@ public function test_new_single(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->checkBox("Checkbox", "checkbox"); - $this->assertEmpty($form->getValue("checkbox")); + static::assertEmpty($form->getValue("checkbox")); - $this->assertFormFlushContains($form, ['Checkbox:error_checkbox']); + static::assertFormFlushContains($form, ['Checkbox:error_checkbox']); } public function test_new_empty_optionArray(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->checkBox("Checkbox", "checkbox", array()); - $this->assertFormFlushContains($form, ['Checkbox:error_checkbox']); + static::assertFormFlushContains($form, ['Checkbox:error_checkbox']); } public function test_new_single_viewmode(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->checkBox("Checkbox", "checkbox"); $form->setFieldViewMode("checkbox"); - $this->assertFormFlushContains($form, ['Checkbox:error_checkbox']); + static::assertFormFlushContains($form, ['Checkbox:error_checkbox']); } public function test_setValue(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->checkBox("Checkbox", "checkbox", $this->aChecks); $form->setValue("checkbox", "c1,c3,"); - $this->assertEquals(array("c1", "c3"), $form->getValue("checkbox")); + static::assertEquals(array("c1", "c3"), $form->getValue("checkbox")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Checkbox:', '', 'error_checkbox' @@ -68,12 +68,12 @@ public function test_setMask(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->checkBox("Checkbox", "checkbox", $this->aChecks, null, null, null, "nofield"); $form->checkBox("Checkbox2", "checkbox2", $this->aChecks, null, null, null, "with a %field%"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Checkbox:nofield', 'nofield', 'nofielderror_checkbox', @@ -87,13 +87,13 @@ public function test_new_array(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->checkBox("Checkbox", "checkbox", $this->aChecks); - $this->assertEmpty($form->getValue("checkbox")); + static::assertEmpty($form->getValue("checkbox")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Checkbox:', '', '', @@ -105,13 +105,13 @@ public function test_new_array_useArrayKeyAsValueFalse(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->checkBox("Checkbox", "checkbox", $this->aChecks, null, false); - $this->assertEmpty($form->getValue("checkbox")); + static::assertEmpty($form->getValue("checkbox")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Checkbox:', '', '', @@ -123,13 +123,13 @@ public function test_new_array_extra(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->checkBox("Checkbox", "checkbox", $this->aChecks, null, null, 'data-extra="true"'); - $this->assertEmpty($form->getValue("checkbox")); + static::assertEmpty($form->getValue("checkbox")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Checkbox:', '', '', @@ -141,13 +141,13 @@ public function test_new_array_mask(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->checkBox("Checkbox", "checkbox", $this->aChecks, null, null, null, "%field%ABC"); - $this->assertEmpty($form->getValue("checkbox")); + static::assertEmpty($form->getValue("checkbox")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Checkbox:ABC', 'ABC', 'ABC', @@ -162,11 +162,11 @@ public function test_posted_single(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->checkBox("Checkbox", "checkbox"); - $this->assertEquals("on", $form->getValue("checkbox")); + static::assertEquals("on", $form->getValue("checkbox")); } public function test_posted_array(): void @@ -176,11 +176,11 @@ public function test_posted_array(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->checkBox("Checkbox", "checkbox", $this->aChecks); - $this->assertEquals(["Check1", "Check2"], $form->getValue("checkbox")); + static::assertEquals(["Check1", "Check2"], $form->getValue("checkbox")); } public function test_posted_single_fillvalue_byinvalid(): void @@ -190,14 +190,14 @@ public function test_posted_single_fillvalue_byinvalid(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->checkBox("Checkbox", "checkbox"); - $this->assertEquals("on", $form->getValue("checkbox")); + static::assertEquals("on", $form->getValue("checkbox")); $form->setError("checkbox", "forcedError"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Checkbox:error_checkbox', 'forcedError' ]); @@ -210,11 +210,11 @@ public function test_posted_array_fillvalue_byinvalid(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->checkBox("Checkbox", "checkbox", $this->aChecks); - $this->assertEquals(["Check1", "Check2"], $form->getValue("checkbox")); + static::assertEquals(["Check1", "Check2"], $form->getValue("checkbox")); } public function test_posted_fillvalue_byinvalid(): void @@ -224,15 +224,15 @@ public function test_posted_fillvalue_byinvalid(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textField("Textfield", "textfield"); - $this->assertEquals("textvalue", $form->getValue("textfield")); + static::assertEquals("textvalue", $form->getValue("textfield")); $form->setError("textfield", "forcedError"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Textfield:error_textfield', 'forcedError' ]); @@ -244,15 +244,15 @@ public function test_validator(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textField("Textfield", "textfield", FH_NOT_EMPTY); - $this->assertEmpty($form->getValue("textfield")); + static::assertEmpty($form->getValue("textfield")); $t = $form->catchErrors(false); - $this->assertEquals( + static::assertEquals( 'You did not enter a correct value for this field!', $t['textfield'] ); @@ -262,38 +262,38 @@ public function test_new_size(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textField("Textfield", "textfield", null, 123); - $this->assertEmpty($form->getValue("textfield")); + static::assertEmpty($form->getValue("textfield")); - $this->assertFormFlushContains($form, ['Textfield:error_textfield']); + static::assertFormFlushContains($form, ['Textfield:error_textfield']); } public function test_new_maxlength(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textField("Textfield", "textfield", null, null, 123); - $this->assertEmpty($form->getValue("textfield")); + static::assertEmpty($form->getValue("textfield")); - $this->assertFormFlushContains($form, ['Textfield:error_textfield']); + static::assertFormFlushContains($form, ['Textfield:error_textfield']); } public function test_new_extra(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textField("Textfield", "textfield", null, null, null, 'data-old="123"'); - $this->assertEmpty($form->getValue("textfield")); + static::assertEmpty($form->getValue("textfield")); - $this->assertFormFlushContains($form, ['Textfield:assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->colorPicker("Colorpicker", "colorpicker"); - $this->assertEmpty($form->getValue("colorpicker")); + static::assertEmpty($form->getValue("colorpicker")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/js/jscolor/jscolor.js', 'Colorpicker:error_colorpicker' ]); @@ -24,13 +24,13 @@ public function test_viewMode(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->colorPicker("Colorpicker", "colorpicker"); $form->setFieldViewMode("colorpicker"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/js/jscolor/jscolor.js', 'Colorpicker:error_colorpicker' ]); @@ -40,11 +40,11 @@ public function test_extraClass(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->colorPicker("Colorpicker", "colorpicker", null, null, null, "class=\"dummy\""); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/js/jscolor/jscolor.js', 'Colorpicker:error_colorpicker' ]); @@ -57,11 +57,11 @@ public function test_posted(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->colorPicker("Colorpicker", "colorpicker"); - $this->assertEquals("FFCC00", $form->getValue("colorpicker")); + static::assertEquals("FFCC00", $form->getValue("colorpicker")); } public function test_posted_fillvalue_byinvalid(): void @@ -71,15 +71,15 @@ public function test_posted_fillvalue_byinvalid(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->colorPicker("Colorpicker", "colorpicker"); - $this->assertEquals("FFCC00", $form->getValue("colorpicker")); + static::assertEquals("FFCC00", $form->getValue("colorpicker")); $form->setError("colorpicker", "forcedError"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Colorpicker:error_colorpicker', 'forcedError' ]); diff --git a/tests/uts/formhandler_ConstructorTest.php b/tests/uts/formhandler_ConstructorTest.php index 76c9155..860026d 100644 --- a/tests/uts/formhandler_ConstructorTest.php +++ b/tests/uts/formhandler_ConstructorTest.php @@ -13,17 +13,17 @@ public function testStandardFormname_POST(): void { $form = new FormHandler(); - $this->assertEquals(FH_DEFAULT_FORM_NAME, $form->getFormName()); - $this->assertFalse($form->isPosted()); - - $this->assertEquals(1, $form->getCurrentPage()); - $this->assertEquals(1, $form->getLastSubmittedPage()); - $this->assertEquals(1, $form->getPage()); - $this->assertEquals(FH_DEFAULT_LANGUAGE, $form->getLang()); - $this->assertEquals(FH_DEFAULT_LANGUAGE, $form->getLanguage()); - $this->assertEmpty($form->getJavascriptCode()); - $this->assertTrue($form->isCorrect()); - $this->assertFalse($form->isViewMode()); + static::assertEquals(FH_DEFAULT_FORM_NAME, $form->getFormName()); + static::assertFalse($form->isPosted()); + + static::assertEquals(1, $form->getCurrentPage()); + static::assertEquals(1, $form->getLastSubmittedPage()); + static::assertEquals(1, $form->getPage()); + static::assertEquals(FH_DEFAULT_LANGUAGE, $form->getLang()); + static::assertEquals(FH_DEFAULT_LANGUAGE, $form->getLanguage()); + static::assertEmpty($form->getJavascriptCode()); + static::assertTrue($form->isCorrect()); + static::assertFalse($form->isViewMode()); $aExpected = [ '
", "

This form is generated by FormHandler

", ]; - $this->assertFormFlushContains($form, $aExpected); + static::assertFormFlushContains($form, $aExpected); } public function testDeviantFormname_POST(): void { $form = new FormHandler("DeviantFormName"); - $this->assertEquals("DeviantFormName", $form->getFormName()); + static::assertEquals("DeviantFormName", $form->getFormName()); - $this->assertFormFlushContains($form, 'flush(true)); + static::assertEquals("", $form->flush(true)); } public function testNoExpose(): void @@ -67,9 +67,9 @@ public function testNoExpose(): void "
" ]; - $html = $this->assertFormFlushContains($form, $aExpected); + $html = static::assertFormFlushContains($form, $aExpected); - $this->assertStringNotContainsString("

This form is generated by FormHandler

", $html); + static::assertStringNotContainsString("

This form is generated by FormHandler

", $html); } public function testTableWith100(): void @@ -78,7 +78,7 @@ public function testTableWith100(): void $form = new FormHandler(); - $this->assertFormFlushContains($form, "
"); + static::assertFormFlushContains($form, "
"); } public function testTableBorder1(): void @@ -87,7 +87,7 @@ public function testTableBorder1(): void $form = new FormHandler(); - $this->assertFormFlushContains($form, "
"); + static::assertFormFlushContains($form, "
"); } public function testTableCellspacing1(): void @@ -96,7 +96,7 @@ public function testTableCellspacing1(): void $form = new FormHandler(); - $this->assertFormFlushContains($form, "
"); + static::assertFormFlushContains($form, "
"); } public function testTableCellpadding1(): void @@ -105,14 +105,14 @@ public function testTableCellpadding1(): void $form = new FormHandler(); - $this->assertFormFlushContains($form, "
"); + static::assertFormFlushContains($form, "
"); } public function testNoField(): void { $form = new FormHandler(); - $this->assertNull($form->getValue("notexist")); + static::assertNull($form->getValue("notexist")); $this->assertTriggertError('Try to get the value of an unknown field "notexist"!', E_USER_WARNING); } @@ -121,11 +121,11 @@ public function testNoName(): void { // three different versions $form = new FormHandler(); - $this->assertEquals(FH_DEFAULT_FORM_NAME, $form->getName()); + static::assertEquals(FH_DEFAULT_FORM_NAME, $form->getName()); $form2 = new FormHandler(); - $this->assertEquals(FH_DEFAULT_FORM_NAME . "1", $form2->getName()); + static::assertEquals(FH_DEFAULT_FORM_NAME . "1", $form2->getName()); $form3 = new FormHandler(); - $this->assertEquals(FH_DEFAULT_FORM_NAME . "2", $form3->getName()); + static::assertEquals(FH_DEFAULT_FORM_NAME . "2", $form3->getName()); } public function testSetAction(): void @@ -134,7 +134,7 @@ public function testSetAction(): void $form = new FormHandler(null, "action"); $a = $this->getPrivateProperty($form, "_action"); - $this->assertEquals("action", $a); + static::assertEquals("action", $a); } public function testSetActionFromQueryString(): void @@ -145,7 +145,7 @@ public function testSetActionFromQueryString(): void $form = new FormHandler(); $a = $this->getPrivateProperty($form, "_action"); - $this->assertEquals("phpself.php", $a); + static::assertEquals("phpself.php", $a); $_SERVER['QUERY_STRING'] = "querystring"; @@ -153,7 +153,7 @@ public function testSetActionFromQueryString(): void $form2 = new FormHandler(); $a = $this->getPrivateProperty($form2, "_action"); - $this->assertEquals("phpself.php?querystring", $a); + static::assertEquals("phpself.php?querystring", $a); } public function testSetExtra(): void @@ -162,6 +162,6 @@ public function testSetExtra(): void $form = new FormHandler(null, null, "extra"); $a = $this->getPrivateProperty($form, "_extra"); - $this->assertEquals("extra", $a); + static::assertEquals("extra", $a); } } diff --git a/tests/uts/formhandler_DataHandlingTest.php b/tests/uts/formhandler_DataHandlingTest.php index 7137ca4..f39650e 100644 --- a/tests/uts/formhandler_DataHandlingTest.php +++ b/tests/uts/formhandler_DataHandlingTest.php @@ -19,20 +19,20 @@ public function testGetAsArray(): void $form->dateField('Date', 'date'); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); list($year, $month, $day) = $form->getAsArray('date'); - $this->assertEquals("2020", $year); - $this->assertEquals("3", $month); - $this->assertEquals("21", $day); + static::assertEquals("2020", $year); + static::assertEquals("3", $month); + static::assertEquals("21", $day); } public function testGetAsArray_expectedError(): void { $form = new FormHandler(); - $this->assertFalse($form->getAsArray('date')); + static::assertFalse($form->getAsArray('date')); $this->assertTriggertError('The datefield "date" does not exists!', E_USER_NOTICE); } @@ -46,10 +46,10 @@ public function testGetValue(): void $form->textField("Name", "name"); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); - $this->assertEquals("Text", $form->getValue("name")); - $this->assertEquals("Text", $form->value("name")); + static::assertEquals("Text", $form->getValue("name")); + static::assertEquals("Text", $form->value("name")); } public function testSetValue(): void @@ -59,11 +59,11 @@ public function testSetValue(): void $form->textField("Name", "name", FH_STRING); $form->setValue("name", "defaultValue"); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $expected = 'value="defaultValue"'; - $this->assertStringContainsString($expected, $form->flush(true)); + static::assertStringContainsString($expected, $form->flush(true)); } public function testAddValue(): void @@ -75,16 +75,16 @@ public function testAddValue(): void $form->textField("Name", "name", FH_STRING); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); - $this->assertEquals("Text", $form->getValue("name")); + static::assertEquals("Text", $form->getValue("name")); $form->addValue("name", "Code"); $form->onCorrect("doRun_ReturnDataName"); $expected = "Code"; - $this->assertStringContainsString($expected, $form->flush(true)); + static::assertStringContainsString($expected, $form->flush(true)); } public function testOnCorrect(): void @@ -99,7 +99,7 @@ public function testOnCorrect(): void $form->onCorrect("doRun_ReturnDataName"); $expected = $_POST['name']; - $this->assertEquals($expected, $form->flush(true)); + static::assertEquals($expected, $form->flush(true)); } public function testOnCorrect_Class(): void @@ -120,7 +120,7 @@ public function testOnCorrect_Class(): void ); $expected = $_POST['name']; - $this->assertEquals($expected, $form->flush(true)); + static::assertEquals($expected, $form->flush(true)); } public function testOnCorrect_Validation_false(): void @@ -136,7 +136,7 @@ public function testOnCorrect_Validation_false(): void $expected = 'Your name has to be at least 3 characters!'; - $this->assertStringContainsString($expected, $form->flush(true)); + static::assertStringContainsString($expected, $form->flush(true)); } public function testOnCorrect_Validation_true(): void @@ -151,7 +151,7 @@ public function testOnCorrect_Validation_true(): void $form->onCorrect("doRun_testOnCorrect_Validation"); $expected = $_POST['name']; - $this->assertEquals($expected, $form->flush(true)); + static::assertEquals($expected, $form->flush(true)); } public function testSetError(): void @@ -163,7 +163,7 @@ public function testSetError(): void $form->setError("name", "This is an error"); $expected = 'This is an error'; - $this->assertStringContainsString($expected, $form->flush(true)); + static::assertStringContainsString($expected, $form->flush(true)); } } diff --git a/tests/uts/formhandler_DateFieldTest.php b/tests/uts/formhandler_DateFieldTest.php index 03cb308..2f2aafc 100644 --- a/tests/uts/formhandler_DateFieldTest.php +++ b/tests/uts/formhandler_DateFieldTest.php @@ -50,7 +50,7 @@ public function test_new(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->dateField("Datefield", "datefield"); @@ -65,14 +65,14 @@ public function test_new(): void $aExpected = array_merge($aExpected, $this->getYears($startYear, $endYear, date('Y'))); $aExpected[] = ' error_datefield'; - $this->assertFormFlushContains($form, $aExpected); + static::assertFormFlushContains($form, $aExpected); } public function test_new_required(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->dateField("Datefield", "datefield", null, true); @@ -87,8 +87,8 @@ public function test_new_required(): void $aExpected = array_merge($aExpected, $this->getYears($startYear, $endYear, date('Y'))); $aExpected[] = ' error_datefield'; - $t = $this->assertFormFlushContains($form, $aExpected); - $this->assertFalse(strpos($t, '')); + $t = static::assertFormFlushContains($form, $aExpected); + static::assertFalse(strpos($t, '')); } public function test_new_no_default(): void @@ -96,7 +96,7 @@ public function test_new_no_default(): void define('FH_DATEFIELD_SET_CUR_DATE', false); $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->dateField("Datefield", "datefield"); @@ -111,14 +111,14 @@ public function test_new_no_default(): void $aExpected = array_merge($aExpected, $this->getYears($startYear, $endYear)); $aExpected[] = ' error_datefield'; - $this->assertFormFlushContains($form, $aExpected); + static::assertFormFlushContains($form, $aExpected); } public function test_interval(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, null, '20:20'); @@ -133,7 +133,7 @@ public function test_interval(): void $aExpected = array_merge($aExpected, $this->getYears($startYear, $endYear, date('Y'))); $aExpected[] = ' error_datefield'; - $this->assertFormFlushContains($form, $aExpected); + static::assertFormFlushContains($form, $aExpected); } public function test_posted(): void @@ -154,22 +154,22 @@ public function test_posted(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateField("Datefield", "datefield"); $form->dateField("Datefield2", "datefield2", null, null, "d.m.y"); $form->dateField("Datefield3", "datefield3", null, null, "y/m/d"); $form->dateField("Datefield4", "datefield4", null, null, "D-M-Y"); - $this->assertEquals("03-04-2018", $form->getValue("datefield")); - $this->assertEquals("03.04.2018", $form->getValue("datefield2")); - $this->assertEquals("2018/04/03", $form->getValue("datefield3")); - $this->assertEquals("03-04-2018", $form->getValue("datefield4")); + static::assertEquals("03-04-2018", $form->getValue("datefield")); + static::assertEquals("03.04.2018", $form->getValue("datefield2")); + static::assertEquals("2018/04/03", $form->getValue("datefield3")); + static::assertEquals("03-04-2018", $form->getValue("datefield4")); - $this->assertEquals([2018, 4, 3], $form->getAsArray("datefield")); - $this->assertEquals([2018, 4, 3], $form->getAsArray("datefield2")); - $this->assertEquals([2018, 4, 3], $form->getAsArray("datefield3")); - $this->assertEquals([2018, 4, 3], $form->getAsArray("datefield4")); + static::assertEquals([2018, 4, 3], $form->getAsArray("datefield")); + static::assertEquals([2018, 4, 3], $form->getAsArray("datefield2")); + static::assertEquals([2018, 4, 3], $form->getAsArray("datefield3")); + static::assertEquals([2018, 4, 3], $form->getAsArray("datefield4")); } public function different_masks(): array @@ -203,18 +203,18 @@ public function test_getValue($different_masks): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, $different_masks[0]); - $this->assertEquals($different_masks[1], $form->getValue("datefield")); + static::assertEquals($different_masks[1], $form->getValue("datefield")); } public function test_new_mask1(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, "y-m-d"); @@ -229,14 +229,14 @@ public function test_new_mask1(): void $aExpected = array_merge($aExpected, $this->getDays(31, date('d'))); $aExpected[] = ' error_datefield'; - $this->assertFormFlushContains($form, $aExpected); + static::assertFormFlushContains($form, $aExpected); } public function test_new_mask2(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, "d.m.y"); @@ -251,7 +251,7 @@ public function test_new_mask2(): void $aExpected = array_merge($aExpected, $this->getYears($startYear, $endYear, date('Y'))); $aExpected[] = ' error_datefield'; - $this->assertFormFlushContains($form, $aExpected); + static::assertFormFlushContains($form, $aExpected); } public function test_new_editfields(): void @@ -259,12 +259,12 @@ public function test_new_editfields(): void define('FH_DATEFIELD_SET_CUR_DATE', false); $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, "D-M-Y"); $form->dateField("Datefield2", "datefield2", null, null, "Y.M-D"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Datefield: - - error_datefield', 'Datefield2: . - error_datefield2' ]); @@ -279,15 +279,15 @@ public function test_posted_editfields_fillvalue_byinvalid(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, "D-M-Y"); - $this->assertEquals("03-04-2018", $form->getValue("datefield")); + static::assertEquals("03-04-2018", $form->getValue("datefield")); $form->setError("datefield", "forcedError"); - $this->assertFormFlushContains($form, 'Datefield: ' . + static::assertFormFlushContains($form, 'Datefield: ' . ' - ' . ' - ' . ' error_datefieldforcedError'); @@ -302,13 +302,13 @@ public function test_posted_editfields_invalidDate(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, "D-M-Y"); - $this->assertEquals("43-04-2018", $form->getValue("datefield")); + static::assertEquals("43-04-2018", $form->getValue("datefield")); - $this->assertFormFlushContains($form, 'Datefield: ' . + static::assertFormFlushContains($form, 'Datefield: ' . ' - ' . ' - ' . ' error_datefieldThe given date is not valid!' @@ -324,11 +324,11 @@ public function test_posted_editfields_invalidDay(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, "D-M-Y"); - $this->assertFormFlushContains($form, 'Datefield: ' . + static::assertFormFlushContains($form, 'Datefield: ' . ' - ' . ' - ' . ' error_datefieldYou did not enter a correct value for this field!' @@ -344,11 +344,11 @@ public function test_posted_editfields_invalidMonth(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, "D-M-Y"); - $this->assertFormFlushContains($form, 'Datefield: ' . + static::assertFormFlushContains($form, 'Datefield: ' . ' - ' . ' - ' . ' error_datefieldYou did not enter a correct value for this field!' @@ -364,11 +364,11 @@ public function test_posted_editfields_invalidYear1(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, "D-M-Y"); - $this->assertFormFlushContains($form, 'Datefield: ' . + static::assertFormFlushContains($form, 'Datefield: ' . ' - ' . ' - ' . ' error_datefieldYou did not enter a correct value for this field!' @@ -384,11 +384,11 @@ public function test_posted_editfields_invalidYear2(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, "D-M-Y"); - $this->assertFormFlushContains($form, 'Datefield: ' . + static::assertFormFlushContains($form, 'Datefield: ' . ' - ' . ' - ' . ' error_datefieldThe given date is not valid!' @@ -399,7 +399,7 @@ public function test_new_extra(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->dateField("Datefield", "datefield", null, null, null, null, 'data-old="123"'); @@ -414,6 +414,6 @@ public function test_new_extra(): void $aExpected = array_merge($aExpected, $this->getYears($startYear, $endYear, date('Y'))); $aExpected[] = ' error_datefield'; - $this->assertFormFlushContains($form, $aExpected); + static::assertFormFlushContains($form, $aExpected); } }; diff --git a/tests/uts/formhandler_DateTextFieldTest.php b/tests/uts/formhandler_DateTextFieldTest.php index 3a96d55..1f01377 100644 --- a/tests/uts/formhandler_DateTextFieldTest.php +++ b/tests/uts/formhandler_DateTextFieldTest.php @@ -8,13 +8,13 @@ public function test_new(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->dateTextField("DateTextField", "datetextfield"); - $this->assertEmpty($form->getValue("datetextfield")); + static::assertEmpty($form->getValue("datetextfield")); - $this->assertFormFlushContains($form, ['DateTextField:error_datetextfield']); + static::assertFormFlushContains($form, ['DateTextField:error_datetextfield']); } public function test_posted(): void @@ -27,28 +27,28 @@ public function test_posted(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateTextField("Datetextfield", "datetextfield"); $form->dateTextField("Datetextfield2", "datetextfield2"); $form->dateTextField("Datetextfield3", "datetextfield3", null, "d.m.Y"); $form->dateTextField("Datetextfield4", "datetextfield4", null, null, true); - $this->assertEquals("14-04-2020", $form->getValue("datetextfield")); - $this->assertEquals("14.04.2020", $form->getValue("datetextfield2")); - $this->assertEquals("14.04.2020", $form->getValue("datetextfield3")); - $this->assertEquals("14-04-2020", $form->getValue("datetextfield4")); // already parsed into correct presentation! + static::assertEquals("14-04-2020", $form->getValue("datetextfield")); + static::assertEquals("14.04.2020", $form->getValue("datetextfield2")); + static::assertEquals("14.04.2020", $form->getValue("datetextfield3")); + static::assertEquals("14-04-2020", $form->getValue("datetextfield4")); // already parsed into correct presentation! - $this->assertEquals([2020, 4, 14], $form->getAsArray("datetextfield")); - $this->assertNull($form->getAsArray("datetextfield2")); + static::assertEquals([2020, 4, 14], $form->getAsArray("datetextfield")); + static::assertNull($form->getAsArray("datetextfield2")); $this->assertTriggertError("Value is not a valid date [14.04.2020]", E_USER_ERROR); - $this->assertEquals([2020, 4, 14], $form->getAsArray("datetextfield3")); - $this->assertEquals([2020, 4, 14], $form->getAsArray("datetextfield4")); + static::assertEquals([2020, 4, 14], $form->getAsArray("datetextfield3")); + static::assertEquals([2020, 4, 14], $form->getAsArray("datetextfield4")); $e = $form->catchErrors(); - $this->assertEquals(1, sizeof($e)); - $this->assertEquals('You did not enter a correct value for this field!', $e['datetextfield2']); + static::assertEquals(1, sizeof($e)); + static::assertEquals('You did not enter a correct value for this field!', $e['datetextfield2']); } public function test_posted_fillvalue_byinvalid(): void @@ -58,15 +58,15 @@ public function test_posted_fillvalue_byinvalid(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateTextField("DateTextField", "datetextfield"); - $this->assertEquals("14-04-2020", $form->getValue("datetextfield")); + static::assertEquals("14-04-2020", $form->getValue("datetextfield")); $form->setError("datetextfield", "forcedError"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'DateTextField:error_datetextfield', 'forcedError' ]); @@ -78,15 +78,15 @@ public function test_validator(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->dateTextField("DateTextField", "datetextfield", FH_NOT_EMPTY); - $this->assertEmpty($form->getValue("datetextfield")); + static::assertEmpty($form->getValue("datetextfield")); $t = $form->catchErrors(false); - $this->assertEquals( + static::assertEquals( 'You did not enter a correct value for this field!', $t['datetextfield'] ); @@ -96,13 +96,13 @@ public function test_new_extra(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->dateTextField("DateTextField", "datetextfield", null, null, null, 'data-old="123"'); - $this->assertEmpty($form->getValue("datetextfield")); + static::assertEmpty($form->getValue("datetextfield")); - $this->assertFormFlushContains($form, ['DateTextField:dateTextField("DateTextField", "datetextfield", null, $dataTestGetAsArray['mask']); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); list($year, $month, $day) = $form->getAsArray('datetextfield'); - $this->assertEquals($dataTestGetAsArray['result']['year'], $year); - $this->assertEquals($dataTestGetAsArray['result']['month'], $month); - $this->assertEquals($dataTestGetAsArray['result']['day'], $day); + static::assertEquals($dataTestGetAsArray['result']['year'], $year); + static::assertEquals($dataTestGetAsArray['result']['month'], $month); + static::assertEquals($dataTestGetAsArray['result']['day'], $day); } /** @@ -169,26 +169,26 @@ public function testParseOtherRepresentaions($dataTestGetAsArray): void $form->dateTextField("DateTextField", "datetextfield", null, null, false); $form->dateTextField("DateTextField2", "datetextfield2", null, null, true); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); if ($dataTestGetAsArray['mask'] != FH_DATETEXTFIELD_DEFAULT_DISPLAY) { - $this->assertNull($form->getAsArray('datetextfield')); + static::assertNull($form->getAsArray('datetextfield')); $this->assertTriggertError("Value is not a valid date [" . $dataTestGetAsArray['value'] . "]", E_USER_ERROR); } else { list($year, $month, $day) = $form->getAsArray('datetextfield'); - $this->assertEquals($dataTestGetAsArray['result']['year'], $year); - $this->assertEquals($dataTestGetAsArray['result']['month'], $month); - $this->assertEquals($dataTestGetAsArray['result']['day'], $day); + static::assertEquals($dataTestGetAsArray['result']['year'], $year); + static::assertEquals($dataTestGetAsArray['result']['month'], $month); + static::assertEquals($dataTestGetAsArray['result']['day'], $day); list($year2, $month2, $day2) = $form->getAsArray('datetextfield2'); - $this->assertEquals($dataTestGetAsArray['result']['year'], $year2); - $this->assertEquals($dataTestGetAsArray['result']['month'], $month2); - $this->assertEquals($dataTestGetAsArray['result']['day'], $day2); + static::assertEquals($dataTestGetAsArray['result']['year'], $year2); + static::assertEquals($dataTestGetAsArray['result']['month'], $month2); + static::assertEquals($dataTestGetAsArray['result']['day'], $day2); } } }; diff --git a/tests/uts/formhandler_EditorTest.php b/tests/uts/formhandler_EditorTest.php index 591752e..97dee23 100644 --- a/tests/uts/formhandler_EditorTest.php +++ b/tests/uts/formhandler_EditorTest.php @@ -8,13 +8,13 @@ public function test_new(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->editor("Editor", "editor"); - $this->assertEmpty($form->getValue("editor")); + static::assertEmpty($form->getValue("editor")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/ckeditor/ckeditor.js', 'Editor:error_editor', 'CKEDITOR.replace( \'editor\', {"toolbar":"Default"', @@ -29,11 +29,11 @@ public function test_posted(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->editor("Editor", "editor"); - $this->assertEquals("textvalue", $form->getValue("editor")); + static::assertEquals("textvalue", $form->getValue("editor")); } public function test_posted_fillvalue_byinvalid(): void @@ -43,15 +43,15 @@ public function test_posted_fillvalue_byinvalid(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->editor("Editor", "editor"); - $this->assertEquals("textvalue", $form->getValue("editor")); + static::assertEquals("textvalue", $form->getValue("editor")); $form->setError("editor", "forcedError"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/ckeditor/ckeditor.js', 'Editor:error_editor', 'CKEDITOR.replace( \'editor\', {"toolbar":"Default"' @@ -64,7 +64,7 @@ public function test_path(): void $form->editor("Editor", "editor", null, "thisisthepath"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/ckeditor/ckeditor.js', 'Editor:error_editor', 'CKEDITOR.replace( \'editor\', {"toolbar":"Default"', @@ -79,7 +79,7 @@ public function test_toolbar(): void $form->editor("Editor", "editor", null, null, "thetoolbar"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/ckeditor/ckeditor.js', 'Editor:error_editor', 'CKEDITOR.replace( \'editor\', {"toolbar":"thetoolbar"', @@ -93,7 +93,7 @@ public function test_skin(): void $form->editor("Editor", "editor", null, null, null, "theskin"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/ckeditor/ckeditor.js', 'Editor:error_editor', 'CKEDITOR.replace( \'editor\', {"toolbar":"Default"', @@ -107,7 +107,7 @@ public function test_size(): void $form->editor("Editor", "editor", null, null, null, null, 123, 456); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/ckeditor/ckeditor.js', 'Editor:error_editor', 'CKEDITOR.replace( \'editor\', {"toolbar":"Default"', @@ -121,7 +121,7 @@ public function test_config(): void $form->editor("Editor", "editor", null, null, null, null, null, null, ["theconfig" => "vals"]); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/ckeditor/ckeditor.js', 'Editor:error_editor', 'CKEDITOR.replace( \'editor\', {"toolbar":"Default"', diff --git a/tests/uts/formhandler_HiddenFieldTest.php b/tests/uts/formhandler_HiddenFieldTest.php index 1e027f4..6f53978 100644 --- a/tests/uts/formhandler_HiddenFieldTest.php +++ b/tests/uts/formhandler_HiddenFieldTest.php @@ -8,13 +8,13 @@ public function test_new(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->hiddenField("hiddenfield", "thevalue"); - $this->assertEquals("thevalue", $form->getValue("hiddenfield")); + static::assertEquals("thevalue", $form->getValue("hiddenfield")); - $this->assertFormFlushContains($form, ['']); + static::assertFormFlushContains($form, ['']); } public function test_posted(): void @@ -24,11 +24,11 @@ public function test_posted(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->hiddenField("hiddenfield"); - $this->assertEquals("hiddenvalue", $form->getValue("hiddenfield")); + static::assertEquals("hiddenvalue", $form->getValue("hiddenfield")); } public function test_posted_fillvalue_byinvalid(): void @@ -38,15 +38,15 @@ public function test_posted_fillvalue_byinvalid(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->hiddenField("hiddenfield"); - $this->assertEquals("hiddenvalue", $form->getValue("hiddenfield")); + static::assertEquals("hiddenvalue", $form->getValue("hiddenfield")); $form->setError("hiddenfield", "forcedError"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ '', 'forcedError' ]); @@ -58,15 +58,15 @@ public function test_validator(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->hiddenField("hiddenfield", "", FH_NOT_EMPTY); - $this->assertEmpty($form->getValue("hiddenfield")); + static::assertEmpty($form->getValue("hiddenfield")); $t = $form->catchErrors(false); - $this->assertEquals( + static::assertEquals( 'You did not enter a correct value for this field!', $t['hiddenfield'] ); @@ -76,12 +76,12 @@ public function test_new_extra(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->hiddenField("hiddenfield", "", null, 'data-old="123"'); - $this->assertEmpty($form->getValue("hiddenfield")); + static::assertEmpty($form->getValue("hiddenfield")); - $this->assertFormFlushContains($form, ['']); + static::assertFormFlushContains($form, ['']); } }; diff --git a/tests/uts/formhandler_ListFieldTest.php b/tests/uts/formhandler_ListFieldTest.php index 386922e..c66c755 100644 --- a/tests/uts/formhandler_ListFieldTest.php +++ b/tests/uts/formhandler_ListFieldTest.php @@ -20,13 +20,13 @@ public function test_new_horizontal(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->listField("Listfield", "listfield", $this->aElements); - $this->assertEmpty($form->getValue("listfield")); + static::assertEmpty($form->getValue("listfield")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Listfield:', 'SelectedAvailable', '', 'Available', '', 'SelectedAvailable', '', 'Available', '', 'SelectedAvailable', '', 'Available', '', 'SelectedAvailable', '', 'Available', '"); + static::assertFormFlushContains($form, ""); } public function test_addLine(): void @@ -24,7 +24,7 @@ public function test_addLine(): void $form->addLine(); $form->addLine("theline"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ "", "" ]); @@ -38,7 +38,7 @@ public function test_useTable(): void $t = (string)$form->flush(true); - $this->assertNotEquals("table", $t); + static::assertNotEquals("table", $t); } public function test_setMask(): void @@ -57,7 +57,7 @@ public function test_setMask(): void $form->textField("Textfield4", "textfield4"); $form->setValue("textfield4", "value4"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Textfield||:||||textfield||||error_textfield||', 'Textfield2:error_textfield2', 'Textfield3--:----%name----error_textfield3--', @@ -76,7 +76,7 @@ public function test_setErrorMessage(): void $form->setErrorMessage("textfield2", "this is another individual errormessage", false); $form->setError("textfield2", "error2"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Textfield:error_textfieldthis is an individual errormessage', 'Textfield2:error_textfield2this is another individual errormessage' ]); @@ -90,11 +90,11 @@ public function test_setLanguage(): void $form = new FormHandler(); $form->setLanguage('nl'); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textField("Textfield", "textfield", FH_DIGIT); - $this->assertFormFlushContains($form, ['De opgegeven waarde is ongeldig!']); + static::assertFormFlushContains($form, ['De opgegeven waarde is ongeldig!']); } public function test_catchErrors(): void @@ -105,17 +105,17 @@ public function test_catchErrors(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textField("Textfield", "textfield", FH_DIGIT); $errors = $form->catchErrors(); - $this->assertEquals('textfield-You did not enter a correct value for this field!', $errors['textfield']); + static::assertEquals('textfield-You did not enter a correct value for this field!', $errors['textfield']); $t = (string)$form->flush(true); - $this->assertFalse(strpos($t, "You did not enter a correct value for this field!")); + static::assertFalse(strpos($t, "You did not enter a correct value for this field!")); } public function test_catchErrors2(): void @@ -126,15 +126,15 @@ public function test_catchErrors2(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textField("Textfield", "textfield", FH_DIGIT); $errors = $form->catchErrors(true); - $this->assertEquals('textfield-You did not enter a correct value for this field!', $errors['textfield']); + static::assertEquals('textfield-You did not enter a correct value for this field!', $errors['textfield']); - $this->assertFormFlushContains($form, ['Textfield:error_textfieldtextfield-You did not enter a correct value for this field!']); + static::assertFormFlushContains($form, ['Textfield:error_textfieldtextfield-You did not enter a correct value for this field!']); } public function test_setTableSettings(): void @@ -145,6 +145,6 @@ public function test_setTableSettings(): void $form->textField("Textfield", "textfield", FH_DIGIT); - $this->assertFormFlushContains($form, ["


  
  theline
"]); + static::assertFormFlushContains($form, ["
"]); } }; diff --git a/tests/uts/formhandler_LookAndFeel_FieldsetTest.php b/tests/uts/formhandler_LookAndFeel_FieldsetTest.php index 6c4f9ad..9d34420 100644 --- a/tests/uts/formhandler_LookAndFeel_FieldsetTest.php +++ b/tests/uts/formhandler_LookAndFeel_FieldsetTest.php @@ -11,7 +11,7 @@ public function test(): void $form->borderStart(); $form->borderStop(); - $this->assertFormFlushContains($form, "BEGINfieldset1END"); + static::assertFormFlushContains($form, "BEGINfieldset1END"); } public function test_entries(): void @@ -22,7 +22,7 @@ public function test_entries(): void $form->textField("Textfield", "textfield"); $form->borderStop(); - $this->assertFormFlushContains($form, 'BEGINfieldset1Textfield:error_textfieldEND'); + static::assertFormFlushContains($form, 'BEGINfieldset1Textfield:error_textfieldEND'); } public function test_Caption(): void @@ -32,7 +32,7 @@ public function test_Caption(): void $form->borderStart("thecaption"); $form->borderStop(); - $this->assertFormFlushContains($form, "BEGINfieldset1thecaptionEND"); + static::assertFormFlushContains($form, "BEGINfieldset1thecaptionEND"); } public function test_Name(): void @@ -42,7 +42,7 @@ public function test_Name(): void $form->borderStart(null, "thename"); $form->borderStop(); - $this->assertFormFlushContains($form, "BEGINthenameEND"); + static::assertFormFlushContains($form, "BEGINthenameEND"); } public function test_Extra(): void @@ -52,6 +52,6 @@ public function test_Extra(): void $form->borderStart(null, null, 'data-old="123"'); $form->borderStop(); - $this->assertFormFlushContains($form, 'BEGINfieldset1data-old="123"END'); + static::assertFormFlushContains($form, 'BEGINfieldset1data-old="123"END'); } }; diff --git a/tests/uts/formhandler_LookAndFeel_newPageTest.php b/tests/uts/formhandler_LookAndFeel_newPageTest.php index db4c76f..6eb12f5 100644 --- a/tests/uts/formhandler_LookAndFeel_newPageTest.php +++ b/tests/uts/formhandler_LookAndFeel_newPageTest.php @@ -22,7 +22,7 @@ public function test(): void $form->textField("Question 3", "q3", FH_STRING); $form->submitButton("Submit"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ '', '', '', @@ -55,7 +55,7 @@ public function test_page2(): void $form->textField("Question 3", "q3", FH_STRING); $form->submitButton("Submit"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ '', '', '', @@ -88,7 +88,7 @@ public function test_page3(): void $form->textField("Question 3", "q3", FH_STRING); $form->submitButton("Submit"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ '', '', '', diff --git a/tests/uts/formhandler_LookAndFeel_setHelpTextTest.php b/tests/uts/formhandler_LookAndFeel_setHelpTextTest.php index 9eea19a..eb583e7 100644 --- a/tests/uts/formhandler_LookAndFeel_setHelpTextTest.php +++ b/tests/uts/formhandler_LookAndFeel_setHelpTextTest.php @@ -11,7 +11,7 @@ public function test(): void $form->textField("Textfield", "textfield"); $form->setHelpText("textfield", "This ist a help text"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/overlib/overlib.js', 'FHTML/overlib/overlib_hideform.js', 'Textfield:setHelpText("textfield", "This ist a help text", "The helptitle"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/overlib/overlib.js', 'FHTML/overlib/overlib_hideform.js', 'Textfield:setHelpIcon("theicon.gif"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/overlib/overlib.js', 'FHTML/overlib/overlib_hideform.js', 'Textfield:error_textfield' diff --git a/tests/uts/formhandler_LookAndFeel_setMaxLengthTest.php b/tests/uts/formhandler_LookAndFeel_setMaxLengthTest.php index 2b17d5d..f17b359 100644 --- a/tests/uts/formhandler_LookAndFeel_setMaxLengthTest.php +++ b/tests/uts/formhandler_LookAndFeel_setMaxLengthTest.php @@ -11,7 +11,7 @@ public function test(): void $form->textArea("Textarea", "textarea"); $form->setMaxLength("textarea", 123); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'FHTML/js/maxlength.js', 'Textarea:error_textarea']); + static::assertFormFlushContains($form, ['Textarea:error_textarea']); } public function test_posted(): void @@ -24,11 +24,11 @@ public function test_posted(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textArea("Textarea", "textarea"); - $this->assertEquals("text\nvalue", $form->getValue("textarea")); + static::assertEquals("text\nvalue", $form->getValue("textarea")); } public function test_posted_fillvalue_byinvalid(): void @@ -38,15 +38,15 @@ public function test_posted_fillvalue_byinvalid(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textArea("Textarea", "textarea"); - $this->assertEquals("textvalue", $form->getValue("textarea")); + static::assertEquals("textvalue", $form->getValue("textarea")); $form->setError("textarea", "forcedError"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Textarea:error_textarea', 'forcedError' ]); @@ -58,15 +58,15 @@ public function test_validator(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textArea("Textarea", "textarea", FH_NOT_EMPTY); - $this->assertEmpty($form->getValue("textarea")); + static::assertEmpty($form->getValue("textarea")); $t = $form->catchErrors(false); - $this->assertEquals( + static::assertEquals( 'You did not enter a correct value for this field!', $t['textarea'] ); @@ -76,38 +76,38 @@ public function test_new_cols(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textArea("Textarea", "textarea", null, 123); - $this->assertEmpty($form->getValue("textarea")); + static::assertEmpty($form->getValue("textarea")); - $this->assertFormFlushContains($form, ['Textarea:error_textarea']); + static::assertFormFlushContains($form, ['Textarea:error_textarea']); } public function test_new_maxlength(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textArea("Textarea", "textarea", null, null, 123); - $this->assertEmpty($form->getValue("textarea")); + static::assertEmpty($form->getValue("textarea")); - $this->assertFormFlushContains($form, ['Textarea:error_textarea']); + static::assertFormFlushContains($form, ['Textarea:error_textarea']); } public function test_new_extra(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textArea("Textarea", "textarea", null, null, null, 'data-old="123"'); - $this->assertEmpty($form->getValue("textarea")); + static::assertEmpty($form->getValue("textarea")); - $this->assertFormFlushContains($form, ['Textarea:error_textarea']); + static::assertFormFlushContains($form, ['Textarea:error_textarea']); } }; diff --git a/tests/uts/formhandler_TextFieldTest.php b/tests/uts/formhandler_TextFieldTest.php index 79b4c9f..284144a 100644 --- a/tests/uts/formhandler_TextFieldTest.php +++ b/tests/uts/formhandler_TextFieldTest.php @@ -8,13 +8,13 @@ public function test_new(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textField("Textfield", "textfield"); - $this->assertEmpty($form->getValue("textfield")); + static::assertEmpty($form->getValue("textfield")); - $this->assertFormFlushContains($form, ['Textfield:error_textfield']); + static::assertFormFlushContains($form, ['Textfield:error_textfield']); } public function test_posted(): void @@ -24,11 +24,11 @@ public function test_posted(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textField("Textfield", "textfield"); - $this->assertEquals("textvalue", $form->getValue("textfield")); + static::assertEquals("textvalue", $form->getValue("textfield")); } public function test_posted_fillvalue_byinvalid(): void @@ -38,15 +38,15 @@ public function test_posted_fillvalue_byinvalid(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textField("Textfield", "textfield"); - $this->assertEquals("textvalue", $form->getValue("textfield")); + static::assertEquals("textvalue", $form->getValue("textfield")); $form->setError("textfield", "forcedError"); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ 'Textfield:error_textfield', 'forcedError' ]); @@ -58,15 +58,15 @@ public function test_validator(): void $form = new FormHandler(); - $this->assertTrue($form->isPosted()); + static::assertTrue($form->isPosted()); $form->textField("Textfield", "textfield", FH_NOT_EMPTY); - $this->assertEmpty($form->getValue("textfield")); + static::assertEmpty($form->getValue("textfield")); $t = $form->catchErrors(false); - $this->assertEquals( + static::assertEquals( 'You did not enter a correct value for this field!', $t['textfield'] ); @@ -76,38 +76,38 @@ public function test_new_size(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textField("Textfield", "textfield", null, 123); - $this->assertEmpty($form->getValue("textfield")); + static::assertEmpty($form->getValue("textfield")); - $this->assertFormFlushContains($form, ['Textfield:error_textfield']); + static::assertFormFlushContains($form, ['Textfield:error_textfield']); } public function test_new_maxlength(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textField("Textfield", "textfield", null, null, 123); - $this->assertEmpty($form->getValue("textfield")); + static::assertEmpty($form->getValue("textfield")); - $this->assertFormFlushContains($form, ['Textfield:error_textfield']); + static::assertFormFlushContains($form, ['Textfield:error_textfield']); } public function test_new_extra(): void { $form = new FormHandler(); - $this->assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textField("Textfield", "textfield", null, null, null, 'data-old="123"'); - $this->assertEmpty($form->getValue("textfield")); + static::assertEmpty($form->getValue("textfield")); - $this->assertFormFlushContains($form, ['Textfield:assertFalse($form->isPosted()); + static::assertFalse($form->isPosted()); $form->textSelectField("Textselectfield", "textselectfield", $this->aOptions); - $this->assertEmpty($form->getValue("textselectfield")); + static::assertEmpty($form->getValue("textselectfield")); - $this->assertFormFlushContains($form, [ + static::assertFormFlushContains($form, [ "