[wp-trac] [WordPress Trac] #45435: Port Gutenberg's `removep` Function to Php
WordPress Trac
noreply at wordpress.org
Fri Nov 30 16:27:26 UTC 2018
#45435: Port Gutenberg's `removep` Function to Php
--------------------------------------+------------------------------
Reporter: conner_bw | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version: 4.9.8
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------------------
Comment (by conner_bw):
Current diff fails this test:
{{{#!php
<?php
public function test_reverse_wpautop() {
$raw = <<< RAW
Hi there!
How's it going?
[shortcode id="1"]Fake[/shortcode]
Ok Bye!
<pre>My
line
breaks
must
remain
</pre>
RAW;
$var = wpautop( $raw );
$var = wpremovep( $var );
$this->assertEquals( trim( $raw ), trim( $var ) );
}
}}}
Expected:
{{{#!php
[shortcode id="1"]Fake[/shortcode]\n
\n
Ok Bye!\n
\n
<pre>My\n
}}}
Actual:
{{{#!php
[shortcode id="1"]Fake[/shortcode]\n
\n
Ok Bye!\n
<pre>My\n
}}}
(I have this test because we wrote our own
[https://github.com/pressbooks/pressbooks/blob/dev/inc/sanitize/namespace.php#L601
reverse_wpautop]. We'd much rather be using a WordPress core function but
we also would need it to pass
[https://github.com/pressbooks/pressbooks/blob/dev/tests/test-
sanitize.php#L337 our two tests]...)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45435#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list