Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions classes/controllers/FrmStylesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,11 @@ public static function get_form_style_class( $class, $style ) {
$frm_style = new FrmStyle( $style );
$style = $frm_style->get_one();

if ( ! $style ) {
// The style was deleted, so use the default style.
$style = ( new FrmStyle( 'default' ) )->get_one();
}

if ( $style ) {
$class .= ' frm_style_' . $style->post_name;
self::maybe_add_rtl_class( $style, $class );
Expand Down
12 changes: 12 additions & 0 deletions tests/phpunit/styles/test_FrmStylesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,16 @@ public function test_save() {
$updated_style = $frm_style->get_one();
$this->assertSame( $style->post_title . ' Updated', $updated_style->post_title );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmStylesController::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

}

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 );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmStylesController::assertNotEmpty()


The method you are trying to call is not defined, which can result in a fatal error.


$deleted_style_id = $default_style->ID + 100000;
$this->assertNull( ( new FrmStyle( $deleted_style_id ) )->get_one() );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmStylesController::assertNull()


The method you are trying to call is not defined, which can result in a fatal error.


$class = FrmStylesController::get_form_style_class( ' with_frm_style', $deleted_style_id );

$this->assertSame( ' with_frm_style frm_style_' . $default_style->post_name, $class );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call to an undefined method test_FrmStylesController::assertSame()


The method you are trying to call is not defined, which can result in a fatal error.

}
}
Loading