-
-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
some improvements to example code #2
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
<?php | ||
class CheckAllWidgetTest extends WebTestCase | ||
|
||
class CheckAllWidgetTest extends CWebTestCase | ||
{ | ||
/** | ||
* Sets up before each test method runs. | ||
*/ | ||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
// set the base URL for the test application. | ||
$this->setBrowserUrl('http://localhost/test-application'); | ||
} | ||
|
||
public function testWidget() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As there is no WebTestCase in example code you should copy code from default app here and extend CWebTestCase so it is more clear what's going on. |
||
{ | ||
$this->open('check/index'); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,11 @@ public function actionIndex() | |
$post->title = "test title"; | ||
$post->text = "test text"; | ||
$post->save(); | ||
echo date('r', $post->created_on); | ||
|
||
// we need to refresh the model since CTimestampBehavior uses | ||
// CDbExpression to set creation date which has to be evaluated by the database | ||
$post->refresh(); | ||
|
||
echo "Post has been created on " . date('r', $post->created_on); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This fix has to be done to not get an exception about converting CDbExpression to string. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just noticed that still |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is useful to show what
$attribute
is for.