@@ -22,46 +22,46 @@ public function testCallbackWrapsContentInExclusionWrapper()
2222 $ content = 'Test content ' ;
2323 $ result = $ this ->shortcode ->callback ([], $ content , 'apbct_skip_encoding ' );
2424
25- $ this ->assertEquals ('%%APBCT_SHORT_CODE_EXCLUDE_EE%%Test content%%APBCT_SHORT_CODE_EXCLUDE_EE%% ' , $ result );
25+ $ this ->assertEquals ('##SCE_0## ' , $ result );
2626 }
2727
2828 public function testChangeContentBeforeEncoderModifyExecutesCallback ()
2929 {
3030 $ content = 'Some content with [apbct_skip_encoding]Test content[/apbct_skip_encoding] ' ;
3131 $ result = $ this ->shortcode ->changeContentBeforeEncoderModify ($ content );
3232
33- $ this ->assertStringContainsString ('%%APBCT_SHORT_CODE_EXCLUDE_EE%%Test content%%APBCT_SHORT_CODE_EXCLUDE_EE%% ' , $ result );
33+ $ this ->assertStringContainsString ('Some content with ##SCE_0## ' , $ result );
3434 }
3535
36- public function testChangeContentAfterEncoderModifyRemovesExclusionWrapper ()
37- {
38- $ content = '%%APBCT_SHORT_CODE_EXCLUDE_EE%%Test content%%APBCT_SHORT_CODE_EXCLUDE_EE%% ' ;
39- $ result = $ this ->shortcode ->changeContentAfterEncoderModify ($ content );
40-
41- $ this ->assertEquals ('Test content ' , $ result );
42- }
43-
44- public function testIsContentExcludedReturnsTrueForExcludedContent ()
36+ public function testClearTitleContentFromShortcodeConstruction ()
4537 {
46- $ content = '%%APBCT_SHORT_CODE_EXCLUDE_EE%% Test content%%APBCT_SHORT_CODE_EXCLUDE_EE%% ' ;
47- $ result = $ this ->shortcode ->isContentExcluded ($ content );
38+ $ content = 'Some content with [apbct_skip_encoding] Test content[/apbct_skip_encoding] ' ;
39+ $ result = $ this ->shortcode ->clearTitleContentFromShortcodeConstruction ($ content );
4840
49- $ this ->assertEquals (1 , $ result );
41+ $ this ->assertEquals (' Some content with Test content ' , $ result );
5042 }
5143
52- public function testIsContentExcludedReturnsFalseForNonExcludedContent ()
44+ public function testClearTitleContentFromShortcodeConstructionSkippingEmail ()
5345 {
54- $ content = 'Test content ' ;
55- $ result = $ this ->shortcode ->isContentExcluded ($ content );
46+ $ content = 'Hah, there is email example@exmple.com and some content with [apbct_skip_encoding] Test content[/apbct_skip_encoding] ' ;
47+ $ result = $ this ->shortcode ->clearTitleContentFromShortcodeConstruction ($ content );
5648
57- $ this ->assertEquals (0 , $ result );
49+ $ this ->assertEquals (' Hah, there is email example@exmple.com and some content with Test content ' , $ result );
5850 }
5951
60- public function testClearTitleContentFromShortcodeConstruction ()
52+ public function testTitleContentWithEmailSkippedAndUnskipped ()
6153 {
62- $ content = 'Some content with [apbct_skip_encoding]Test content[/apbct_skip_encoding] ' ;
63- $ result = $ this ->shortcode ->clearTitleContentFromShortcodeConstruction ($ content );
64-
65- $ this ->assertEquals ('Some content with Test content ' , $ result );
54+ $ origin_content = 'Hah, there is email example@exmple.com and some content with [apbct_skip_encoding]Test content[/apbct_skip_encoding] ' ;
55+ $ content = $ origin_content ;
56+ //emulate hook before
57+ $ content = $ this ->shortcode ->changeContentBeforeEncoderModify ($ content );
58+ //do common modifying
59+ $ content = \Cleantalk \ApbctWP \Antispam \EmailEncoder::getInstance ()->modifyContent ($ content );
60+ //emulate hook after
61+ $ content = $ this ->shortcode ->changeContentAfterEncoderModify ($ content );
62+
63+ $ this ->assertStringNotContainsString ( 'example@exmple.com ' , $ content );
64+ $ this ->assertStringNotContainsString ( 'apbct_skip_encoding ' , $ content );
65+ $ this ->assertStringContainsString ( 'with Test content ' , $ content );
6666 }
6767}
0 commit comments