web/wp-content/plugins/ghost-runner/src/Import.php
/**
	 * Import form and page from test row
	 *
	 * @param $test
	 * @param $contentPattern
	 */
Import form and page from test row
@param $test
@param $contentPattern
Import form and page from test row @param $test @param $contentPattern
protected function addTest( Test $test, $contentPattern )
	{
		$linkPattern = '<div class="ghost-runner-import-report">%s - <a href="%s">Form</a> - <a href="%s">Page</a>';
		$config = json_decode( $test->config, true );
		if( ! $config ){
			return;
		}
		$form = \Caldera_Forms_Forms::create_form( $config );
		if ( is_array( $form ) && isset( $form[ 'ID' ] ) ) {
			$editUrl = calderaGhostRunnerFormUrl( $form[ 'ID' ] );
			$content = sprintf(
				$contentPattern,
				esc_attr( $form[ 'ID' ] ),
				esc_html( $test->description ),
				esc_url( 'https://github.com/calderawp/caldera-forms/issues/' . $test->gitissue ),
				esc_html( $test->gitissue ),
				esc_url( $editUrl )
			);
			$id = wp_insert_post( array(
				'post_title'   => $test->name,
				'post_type'    => 'page',
				'post_content' => $content,
				'post_status'  => 'publish'
			) );
			if ( is_numeric( $id ) ) {
				add_post_meta( $id, 'CGR_gitIssue', $test->gitissue, true );
				add_post_meta( $id, 'CGR_release', $test->release, true );
				add_post_meta( $id, 'CGR_ghostInspectorID', $test->ghostinspectorid, true );
				$post = get_post( $id );
				printf( $linkPattern, esc_html( $test->name ), esc_url( $editUrl ), esc_url( get_permalink( $post ) ) );
			}
		}
	}
protected function addTest ( Test $ test , $ contentPattern ) { $ linkPattern = '<div class="ghost-runner-import-report">%s - <a href="%s">Form</a> - <a href="%s">Page</a>' ; $ config = json_decode ( $ test -> config , true ) ; if ( ! $ config ) { return ; } $ form = \ Caldera_Forms_Forms :: create_form ( $ config ) ; if ( is_array ( $ form ) && isset ( $ form [ 'ID' ] ) ) { $ editUrl = calderaGhostRunnerFormUrl ( $ form [ 'ID' ] ) ; $ content = sprintf ( $ contentPattern , esc_attr ( $ form [ 'ID' ] ) , esc_html ( $ test -> description ) , esc_url ( 'https://github.com/calderawp/caldera-forms/issues/' . $ test -> gitissue ) , esc_html ( $ test -> gitissue ) , esc_url ( $ editUrl ) ) ; $ id = wp_insert_post ( array ( 'post_title' => $ test -> name , 'post_type' => 'page' , 'post_content' => $ content , 'post_status' => 'publish' ) ) ; if ( is_numeric ( $ id ) ) { add_post_meta ( $ id , 'CGR_gitIssue' , $ test -> gitissue , true ) ; add_post_meta ( $ id , 'CGR_release' , $ test -> release , true ) ; add_post_meta ( $ id , 'CGR_ghostInspectorID' , $ test -> ghostinspectorid , true ) ; $ post = get_post ( $ id ) ; printf ( $ linkPattern , esc_html ( $ test -> name ) , esc_url ( $ editUrl ) , esc_url ( get_permalink ( $ post ) ) ) ; } } }
Import form and page from test row
 @param $test
 @param $contentPattern
Import form and page from test row @param $test @param $contentPattern
//@TODO Remove this echo