array('buttonConfig' =>'testcase', 'buttonConfig2' => 'cut,copy,paste,pastetext,pasteword,selectall,separator,search,replace,separator,bullist,numlist,separator,outdent, indent,separator,ltr,rtl,separator,undo,redo,separator, link,unlink,anchor,image,separator,sub,sup,separator,charmap, visualaid', 'buttonConfig3' => 'tablecontrols,separator,advhr,hr,removeformat,separator,insertdate,inserttime,separator,preview'), 'badkey1' => 'bad data1'); ?>"); file_put_contents(self::$customDefaultConfigFile, " 'upload[testlength|ratio|initialtest|mintestsize|threads|maxchunksize|maxchunkcount],download[testlength|initialtest|mintestsize|threads|maximagesize]', 'badkey2' => 'bad data2'); ?>" ); $tinySugar = new SugarTinyMCE(); self::$MCE = $tinySugar->getInstance(); } /* * Teardown: remove new custom files and restore the previous ones */ public static function tearDownAfterClass(){ unlink(self::$customConfigFile); unlink(self::$customDefaultConfigFile); if(file_exists(self::$customConfigFile . ".bak")){ rename(self::$customConfigFile . ".bak", self::$customConfigFile); } if(file_exists(self::$customDefaultConfigFile . ".bak")){ rename(self::$customDefaultConfigFile . ".bak", self::$customDefaultConfigFile); } } public function testCheckValidCustomButtonOverrdide(){ $this->assertContains("testcase", self::$MCE, "TinyMCE custom button not found."); } public function testCheckInvalidCustomButtonOverrdide(){ $pos = strpos("badkey1", self::$MCE); if($pos === false){ $pos = 0; } $this->assertEquals(0, $pos, "Invalid custom button found. Stripping code failed."); } public function testCheckValidDefaultOverrdide(){ $this->assertContains("download", self::$MCE, "TinyMCE custom config not found."); } public function testCheckInvalidDefaultOverrdide(){ $pos = strpos("badkey2", self::$MCE); if($pos === false){ $pos = 0; } $this->assertEquals(0, $pos, "Invalid custom config found. Stripping code failed."); } }