assertFileExists( $path, $name ); $source = file_get_contents( $path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local test fixture. $this->assertMatchesRegularExpression( '/^\s*<\?php\s*\/\*\*.*?\*\sTitle:\s*.+$/ms', $source, $name ); $this->assertMatchesRegularExpression( '/^\s*\*\sSlug:\s*chrnx\/' . preg_quote( $name, '/' ) . '\s*$/m', $source, $name ); $this->assertMatchesRegularExpression( '/^\s*\*\sCategories:\s*\S.+$/m', $source, $name ); $this->assertMatchesRegularExpression( '/^\s*\*\sDescription:\s*\S.+$/m', $source, $name ); $this->assertMatchesRegularExpression( '/^\s*\*\sInserter:\s*(?:yes|no)\s*$/m', $source, $name ); if ( preg_match( '/(?:__|_e)\s*\(/', $source ) ) { $this->assertStringContainsString( "'chrnx'", $source, $name ); } $content = $this->render_pattern( $path ); $blocks = parse_blocks( $content ); $this->assertNotEmpty( $blocks, $name ); $this->assertSame( trim( $content ), trim( serialize_blocks( $blocks ) ), $name ); foreach ( $blocks as $parsed_block ) { if ( null === $parsed_block['blockName'] ) { $this->assertSame( '', trim( $parsed_block['innerHTML'] ), $name . ' has non-block content' ); } } $this->assertStringContainsString( '