Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
systems:yii2:testing_examples [2018/04/23 08:39] smayr [Users] |
systems:yii2:testing_examples [2018/04/24 15:44] (current) smayr [Forms] |
||
---|---|---|---|
Line 2: | Line 2: | ||
== Saving to Database == | == Saving to Database == | ||
+ | Add records to a table using any of these: | ||
+ | <code php> | ||
+ | $tblUser = Yii:: | ||
+ | $this-> | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ]); | ||
+ | $user_id = $this-> | ||
+ | </ | ||
+ | |||
+ | Update database records: | ||
+ | <code php> | ||
+ | $tblUser = Yii:: | ||
+ | // Updates user record to be used | ||
+ | $this-> | ||
+ | </ | ||
+ | |||
Check records in a table using any of these: | Check records in a table using any of these: | ||
<code php> | <code php> | ||
$this-> | $this-> | ||
- | $this-> | + | $this-> |
- | $this-> | + | $this-> |
</ | </ | ||
Line 61: | Line 86: | ||
} | } | ||
| | ||
+ | function testRecordCanBeChanged() | ||
+ | { | ||
+ | // Create an Price record from framework. | ||
+ | $id = $this-> | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ]); | ||
+ | $this-> | ||
+ | $this-> | ||
+ | | ||
+ | // Access model | ||
+ | $price = \app\models\Price:: | ||
+ | // | ||
+ | $price-> | ||
+ | $price-> | ||
+ | $this-> | ||
+ | | ||
+ | // Verify data was saved using framework methods | ||
+ | $this-> | ||
+ | $this-> | ||
+ | } | ||
//... | //... | ||
} | } | ||
Line 66: | Line 113: | ||
== Comments == | == Comments == | ||
+ | Use '' | ||
<code php> | <code php> | ||
- | $I->wantTo(' | + | $I->amGoingTo(' |
$I-> | $I-> | ||
+ | $I-> | ||
</ | </ | ||
Line 77: | Line 126: | ||
$I-> | $I-> | ||
$I-> | $I-> | ||
+ | |||
+ | // User Details | ||
+ | $user = \app\models\User:: | ||
+ | $I-> | ||
// Logout | // Logout | ||
Line 83: | Line 136: | ||
$I-> | $I-> | ||
$I-> | $I-> | ||
+ | |||
</ | </ | ||
Line 122: | Line 176: | ||
$I-> | $I-> | ||
} | } | ||
+ | </ | ||
+ | |||
+ | With fields, you can fill them in several says, all meaning the same thing: | ||
+ | <code php> | ||
+ | // All equivalent (input box) | ||
+ | $I-> | ||
+ | $I-> | ||
+ | $I-> | ||
+ | $I-> | ||
+ | $I-> | ||
+ | $I-> | ||
+ | $I-> | ||
+ | $I-> | ||
+ | |||
+ | // All equivalent (selection box) | ||
+ | $I-> | ||
+ | $I-> | ||
+ | $I-> | ||
+ | </ | ||
+ | |||
+ | == Debug == | ||
+ | <code php> | ||
+ | // Access model | ||
+ | $entry = \app\models\Entry:: | ||
+ | codecept_debug(" | ||
</ | </ |