@@ -1042,10 +1042,10 @@ public function testSubmitForm()
1042
1042
$ form = data::get ('form ' );
1043
1043
$ this ->assertEquals ('Davert ' , $ form ['name ' ]);
1044
1044
$ this ->assertEquals ('Is Codeception maintainer ' , $ form ['description ' ]);
1045
- $ this ->assertFalse ( isset ( $ form [ 'disabled_fieldset ' ]) );
1046
- $ this ->assertFalse ( isset ( $ form [ 'disabled_fieldset_textarea ' ]) );
1047
- $ this ->assertFalse ( isset ( $ form [ 'disabled_fieldset_select ' ]) );
1048
- $ this ->assertFalse ( isset ( $ form [ 'disabled_field ' ]) );
1045
+ $ this ->assertArrayNotHasKey ( 'disabled_fieldset ' , $ form );
1046
+ $ this ->assertArrayNotHasKey ( 'disabled_fieldset_textarea ' , $ form );
1047
+ $ this ->assertArrayNotHasKey ( 'disabled_fieldset_select ' , $ form );
1048
+ $ this ->assertArrayNotHasKey ( 'disabled_field ' , $ form );
1049
1049
$ this ->assertEquals ('kill_all ' , $ form ['action ' ]);
1050
1050
}
1051
1051
@@ -1209,8 +1209,8 @@ public function testSubmitFormWithTwoSubmitButtonsSubmitsCorrectValue()
1209
1209
$ this ->module ->seeElement ("#button2 " );
1210
1210
$ this ->module ->click ("#button2 " );
1211
1211
$ form = data::get ('form ' );
1212
- $ this ->assertTrue ( isset ( $ form [ 'button2 ' ]) );
1213
- $ this ->assertTrue ( isset ( $ form [ 'username ' ]) );
1212
+ $ this ->assertArrayHasKey ( 'button2 ' , $ form );
1213
+ $ this ->assertArrayHasKey ( 'username ' , $ form );
1214
1214
$ this ->assertEquals ('value2 ' , $ form ['button2 ' ]);
1215
1215
$ this ->assertEquals ('fred ' , $ form ['username ' ]);
1216
1216
}
@@ -1224,8 +1224,8 @@ public function testSubmitFormWithTwoSubmitButtonsSubmitsCorrectValueAfterFillFi
1224
1224
$ this ->module ->fillField ("username " , "bob " );
1225
1225
$ this ->module ->click ("#button2 " );
1226
1226
$ form = data::get ('form ' );
1227
- $ this ->assertTrue ( isset ( $ form [ 'button2 ' ]) );
1228
- $ this ->assertTrue ( isset ( $ form [ 'username ' ]) );
1227
+ $ this ->assertArrayHasKey ( 'button2 ' , $ form );
1228
+ $ this ->assertArrayHasKey ( 'username ' , $ form );
1229
1229
$ this ->assertEquals ('value2 ' , $ form ['button2 ' ]);
1230
1230
$ this ->assertEquals ('bob ' , $ form ['username ' ]);
1231
1231
}
@@ -1268,8 +1268,8 @@ public function testSubmitFormWithDefaultRadioAndCheckboxValues()
1268
1268
'test ' => 'value '
1269
1269
));
1270
1270
$ form = data::get ('form ' );
1271
- $ this ->assertTrue ( isset ( $ form [ 'checkbox1 ' ]) , 'Checkbox value not sent ' );
1272
- $ this ->assertTrue ( isset ( $ form [ 'radio1 ' ]) , 'Radio button value not sent ' );
1271
+ $ this ->assertArrayHasKey ( 'checkbox1 ' , $ form , 'Checkbox value not sent ' );
1272
+ $ this ->assertArrayHasKey ( 'radio1 ' , $ form , 'Radio button value not sent ' );
1273
1273
$ this ->assertEquals ('testing ' , $ form ['checkbox1 ' ]);
1274
1274
$ this ->assertEquals ('to be sent ' , $ form ['radio1 ' ]);
1275
1275
}
@@ -1281,15 +1281,15 @@ public function testSubmitFormCheckboxWithBoolean()
1281
1281
'checkbox1 ' => true
1282
1282
));
1283
1283
$ form = data::get ('form ' );
1284
- $ this ->assertTrue ( isset ( $ form [ 'checkbox1 ' ]) , 'Checkbox value not sent ' );
1284
+ $ this ->assertArrayHasKey ( 'checkbox1 ' , $ form , 'Checkbox value not sent ' );
1285
1285
$ this ->assertEquals ('testing ' , $ form ['checkbox1 ' ]);
1286
1286
1287
1287
$ this ->module ->amOnPage ('/form/example16 ' );
1288
1288
$ this ->module ->submitForm ('form ' , array (
1289
1289
'checkbox1 ' => false
1290
1290
));
1291
1291
$ form = data::get ('form ' );
1292
- $ this ->assertFalse ( isset ( $ form [ 'checkbox1 ' ]) , 'Checkbox value sent ' );
1292
+ $ this ->assertArrayNotHasKey ( 'checkbox1 ' , $ form , 'Checkbox value sent ' );
1293
1293
}
1294
1294
1295
1295
public function testSubmitFormWithCheckboxesWithoutValue ()
@@ -1320,7 +1320,7 @@ public function testSubmitFormWithButtons()
1320
1320
isset ($ form ['button1 ' ]) || isset ($ form ['button2 ' ]) || isset ($ form ['button4 ' ]),
1321
1321
'Button values for buttons 1, 2 and 4 should not be set '
1322
1322
);
1323
- $ this ->assertTrue ( isset ( $ form [ 'button3 ' ]) , 'Button value for button3 should be set ' );
1323
+ $ this ->assertArrayHasKey ( 'button3 ' , $ form , 'Button value for button3 should be set ' );
1324
1324
$ this ->assertEquals ($ form ['button3 ' ], 'third ' , 'Button value for button3 should equal third ' );
1325
1325
1326
1326
$ this ->module ->amOnPage ('/form/form_with_buttons ' );
@@ -1332,7 +1332,7 @@ public function testSubmitFormWithButtons()
1332
1332
isset ($ form ['button1 ' ]) || isset ($ form ['button2 ' ]) || isset ($ form ['button3 ' ]),
1333
1333
'Button values for buttons 1, 2 and 3 should not be set '
1334
1334
);
1335
- $ this ->assertTrue ( isset ( $ form [ 'button4 ' ]) , 'Button value for button4 should be set ' );
1335
+ $ this ->assertArrayHasKey ( 'button4 ' , $ form , 'Button value for button4 should be set ' );
1336
1336
$ this ->assertEquals ($ form ['button4 ' ], 'fourth ' , 'Button value for button4 should equal fourth ' );
1337
1337
}
1338
1338
@@ -1441,8 +1441,8 @@ public function testSubmitAdjacentForms()
1441
1441
$ this ->module ->amOnPage ('/form/submit_adjacentforms ' );
1442
1442
$ this ->module ->submitForm ('#form-2 ' , []);
1443
1443
$ data = data::get ('form ' );
1444
- $ this ->assertTrue ( isset ( $ data [ 'second-field ' ]) );
1445
- $ this ->assertFalse ( isset ( $ data [ 'first-field ' ]) );
1444
+ $ this ->assertArrayHasKey ( 'second-field ' , $ data );
1445
+ $ this ->assertArrayNotHasKey ( 'first-field ' , $ data );
1446
1446
$ this ->assertEquals ('Killgore Trout ' , $ data ['second-field ' ]);
1447
1447
}
1448
1448
@@ -1453,17 +1453,17 @@ public function testSubmitAdjacentFormsByButton()
1453
1453
$ this ->module ->fillField ('second-field ' , 'Second ' );
1454
1454
$ this ->module ->click ('#submit1 ' );
1455
1455
$ data = data::get ('form ' );
1456
- $ this ->assertTrue ( isset ( $ data [ 'first-field ' ]) );
1457
- $ this ->assertFalse ( isset ( $ data [ 'second-field ' ]) );
1456
+ $ this ->assertArrayHasKey ( 'first-field ' , $ data );
1457
+ $ this ->assertArrayNotHasKey ( 'second-field ' , $ data );
1458
1458
$ this ->assertEquals ('First ' , $ data ['first-field ' ]);
1459
1459
1460
1460
$ this ->module ->amOnPage ('/form/submit_adjacentforms ' );
1461
1461
$ this ->module ->fillField ('first-field ' , 'First ' );
1462
1462
$ this ->module ->fillField ('second-field ' , 'Second ' );
1463
1463
$ this ->module ->click ('#submit2 ' );
1464
1464
$ data = data::get ('form ' );
1465
- $ this ->assertFalse ( isset ( $ data [ 'first-field ' ]) );
1466
- $ this ->assertTrue ( isset ( $ data [ 'second-field ' ]) );
1465
+ $ this ->assertArrayNotHasKey ( 'first-field ' , $ data );
1466
+ $ this ->assertArrayHasKey ( 'second-field ' , $ data );
1467
1467
$ this ->assertEquals ('Second ' , $ data ['second-field ' ]);
1468
1468
}
1469
1469
0 commit comments