From df91dfa114afde4aeefe40509a7ff8f343f54083 Mon Sep 17 00:00:00 2001 From: Felix Zapata Date: Sat, 12 Aug 2017 17:31:45 +0200 Subject: [PATCH] feat(constants): support PHP constants as textdomains --- test/fixtures/correct-domain-constant.php | 25 +++++++++++++++++++++++ test/test.js | 25 +++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 test/fixtures/correct-domain-constant.php diff --git a/test/fixtures/correct-domain-constant.php b/test/fixtures/correct-domain-constant.php new file mode 100644 index 0000000..0398b2a --- /dev/null +++ b/test/fixtures/correct-domain-constant.php @@ -0,0 +1,25 @@ + \ No newline at end of file diff --git a/test/test.js b/test/test.js index e27149c..abc868f 100644 --- a/test/test.js +++ b/test/test.js @@ -254,5 +254,30 @@ describe('gulp-checktextdomain', function() { }); }); + it('10) Should review that the domain (set as a constant) is ok', function(done) { + var actual; + var corrected; + var expected; + var options = { + force: true, + text_domain: 'MY_CUSTOM_CONSTANT', + create_report_file: true, + keywords: keywords + }; + + gulp.src(fixtures('correct-domain-constant.php')) + .pipe(checktextdomain(options)) + .pipe(sassert.first(function(d) { + //File is correct, should report no errors + actual = JSON.parse(fs.readFileSync('.correct-domain-constant.json')); + actual[path.join(__dirname, 'temp/correct-domain-constant.php')].length.should.equal(0); + + //Clean up: Delete report file + fs.remove('.correct-domain-constant.json'); + })) + .pipe(sassert.end(done)); + + }); + });