diff --git a/tests/codeception/tests/integration.suite.yml b/tests/codeception/tests/integration.suite.yml index 50f5eaa4f6b1f55920ce0525bee4a6a7d7cc09e7..ee87e7ae18c2e29ebc48f5b5b074d6f8d68c4ad5 100644 --- a/tests/codeception/tests/integration.suite.yml +++ b/tests/codeception/tests/integration.suite.yml @@ -4,8 +4,23 @@ modules: enabled: + - WPDb - WPLoader 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: multisite: false wpRootFolder: '%WP_ROOT_FOLDER%' diff --git a/tests/codeception/tests/integration/TestAjaxHandler.php b/tests/codeception/tests/integration/AjaxHandlerTest.php similarity index 80% rename from tests/codeception/tests/integration/TestAjaxHandler.php rename to tests/codeception/tests/integration/AjaxHandlerTest.php index eebf7cfeb73da974c2b85aea22b17f23b2560988..c4e402edcc86ec5a7232a07dbfad9d09fa497dd1 100644 --- a/tests/codeception/tests/integration/TestAjaxHandler.php +++ b/tests/codeception/tests/integration/AjaxHandlerTest.php @@ -6,7 +6,7 @@ use Codeception\TestCase\WPTestCase; use \WPDesk\Notice\AjaxHandler; use \WPDesk\Notice\PermanentDismissibleNotice; -class TestAjaxHandler extends WPTestCase { +class AjaxHandlerTest extends WPTestCase { const ASSETS_URL = 'http://test.com/test/assetes/'; const NOTICE_NAME = 'test_notice_name'; @@ -68,7 +68,7 @@ class TestAjaxHandler extends WPTestCase { $ajaxHandler->hooks(); $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> ' );