Skip to content
Snippets Groups Projects
Commit 89330e07 authored by Grzegorz Rola's avatar Grzegorz Rola
Browse files

feature(ajax): added nonce

parent e90452b9
No related branches found
No related tags found
1 merge request!26feature(ajax): added nonce
Pipeline #166096 failed
...@@ -4,8 +4,23 @@ ...@@ -4,8 +4,23 @@
modules: modules:
enabled: enabled:
- WPDb
- WPLoader - WPLoader
config: config:
WPDb:
dsn: 'mysql:host=%TEST_SITE_DB_HOST%;dbname=%TEST_SITE_DB_NAME%'
user: '%TEST_SITE_DB_USER%'
password: '%TEST_SITE_DB_PASSWORD%'
dump: 'tests/codeception/tests/_data/db.sql'
#import the dump before the tests; this means the test site database will be repopulated before the tests.
populate: false
# re-import the dump between tests; this means the test site database will be repopulated between the tests.
cleanup: false
waitlock: 10
url: '%TEST_SITE_WP_URL%'
originalUrl: '%TEST_SITE_WP_URL%'
urlReplacement: true #replace the hardcoded dump URL with the one above
tablePrefix: '%TEST_SITE_TABLE_PREFIX%'
WPLoader: WPLoader:
multisite: false multisite: false
wpRootFolder: '%WP_ROOT_FOLDER%' wpRootFolder: '%WP_ROOT_FOLDER%'
......
...@@ -6,7 +6,7 @@ use Codeception\TestCase\WPTestCase; ...@@ -6,7 +6,7 @@ use Codeception\TestCase\WPTestCase;
use \WPDesk\Notice\AjaxHandler; use \WPDesk\Notice\AjaxHandler;
use \WPDesk\Notice\PermanentDismissibleNotice; use \WPDesk\Notice\PermanentDismissibleNotice;
class TestAjaxHandler extends WPTestCase { class AjaxHandlerTest extends WPTestCase {
const ASSETS_URL = 'http://test.com/test/assetes/'; const ASSETS_URL = 'http://test.com/test/assetes/';
const NOTICE_NAME = 'test_notice_name'; const NOTICE_NAME = 'test_notice_name';
...@@ -68,7 +68,7 @@ class TestAjaxHandler extends WPTestCase { ...@@ -68,7 +68,7 @@ class TestAjaxHandler extends WPTestCase {
$ajaxHandler->hooks(); $ajaxHandler->hooks();
$this->expectOutputString( '<script type="text/javascript"> $this->expectOutputString( '<script type="text/javascript">
' . file_get_contents( __DIR__ . '/../../assets/js/notice.js' ) . ' jQuery(document).on("click",".notice-dismiss",function(){var a=jQuery(this).closest("div.notice").data("notice-name");var b=jQuery(this).closest("div.notice").data("source");if(""!==a){jQuery.ajax({url:ajaxurl,type:"post",data:{action:"wpdesk_notice_dismiss",notice_name:a,source:b},success:function(c){}})}});jQuery(document).on("click",".notice-dismiss-link",function(){jQuery(this).closest("div.notice").data("source",jQuery(this).data("source"));jQuery(this).closest("div.notice").find(".notice-dismiss").click()});
</script> </script>
' '
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment