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 = [ '