Repository navigation
Fall back to the default style when a form's style was deleted #3610
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
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 |
|---|---|---|
|
|
@@ -185,4 +185,16 @@ public function test_save() { | |
| $updated_style = $frm_style->get_one(); | ||
| $this->assertSame( $style->post_title . ' Updated', $updated_style->post_title ); | ||
| } | ||
|
|
||
| public function test_get_form_style_class_falls_back_to_default_style_when_style_is_deleted() { | ||
| $default_style = ( new FrmStyle( 'default' ) )->get_one(); | ||
| $this->assertNotEmpty( $default_style ); | ||
|
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.
|
||
|
|
||
| $deleted_style_id = $default_style->ID + 100000; | ||
| $this->assertNull( ( new FrmStyle( $deleted_style_id ) )->get_one() ); | ||
|
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.
|
||
|
|
||
| $class = FrmStylesController::get_form_style_class( ' with_frm_style', $deleted_style_id ); | ||
|
|
||
| $this->assertSame( ' with_frm_style frm_style_' . $default_style->post_name, $class ); | ||
|
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.
|
||
| } | ||
| } | ||
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.
The method you are trying to call is not defined, which can result in a fatal error.