createExamples(); $strings = new CRM_Core_Resources_Strings( new CRM_Utils_Cache_Arraycache(NULL) ); $this->assertEquals( ['Hello from Javascript'], $strings->get('example', "$basedir/hello.js", "text/javascript") ); $this->assertEquals( ['Hello from HTML'], $strings->get('example', "$basedir/hello.html", "text/html") ); } /** * @return string * Path to the example dir. */ public function createExamples() { $basedir = rtrim($this->createTempDir('ext-'), '/'); file_put_contents("$basedir/hello.js", "alert(ts('Hello from Javascript'));"); file_put_contents("$basedir/hello.html", "
{{ts('Hello from HTML')}}
"); return $basedir; } }