<commit_before><?php

require_once('_HelpersUnitTester.php');
require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'prototype_helper.php');
require_once(AK_LIB_DIR.DS.'AkActionController.php');
require_once(AK_LIB_DIR.DS.'AkRequest.php');

class PrototypeHelperTests extends HelpersUnitTester
{
    function test_setup()
    {
        $Controller = &new AkActionController();
        $Controller->Request =& new AkRequest();
        $Controller->controller_name = 'test';
        $Controller->instantiateHelpers();
        
        $this->PrototypeHelper =& $Controller->prototype_helper;
    }
    
    /**
     * @todo Add all the tests for prototype helper
     */
    
    function test_submit_to_remote()
    {
        $this->assertEqual("<input name=\"More beer!\" onclick=\"new Ajax.Updater('empty_bottle', 'http://www.example.com/', {parameters:Form.serialize(this.form)}); return false;\" type=\"button\" value=\"1000000\" />",<commit_msg>Avoiding the use of AkRequest on prototype helper as it breaks AkRequest tests<commit_after><?php

require_once('_HelpersUnitTester.php');
require_once(AK_LIB_DIR.DS.'AkActionView'.DS.'helpers'.DS.'prototype_helper.php');
require_once(AK_LIB_DIR.DS.'AkActionController.php');
require_once(AK_LIB_DIR.DS.'AkRequest.php');

Mock::generate('AkRequest');

class PrototypeHelperTests extends HelpersUnitTester
{
    function test_setup()
    {
        $Controller = &new AkActionController();
        $Controller->Request =& new MockAkRequest($this);
        $Controller->controller_name = 'test';
        $Controller->instantiateHelpers();
        
        $this->PrototypeHelper =& $Controller->prototype_helper;
    }
    
    /**
     * @todo Add all the tests for prototype helper
     */
    
    function test_submit_to_remote()
    {
        $this->assertEqual("<input name=\"More beer!\" onclick=\"new Ajax.Updater('empty_bottle', 'http://www.example.com/', {parameters:Form.serialize(this.form)}); return false;\" type=\"button\" value=\"1000000\" />",
{'fraction_non_alphanumeric': 0.15223880597014924, 'fraction_numerical': 0.006965174129353234, 'mean_word_length': 3.941031941031941, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2977620', 'n_tokens_mistral': 613, 'n_tokens_neox': 598, 'n_words': 99}