<commit_before><commit_msg>Added tests for the Mage_Test patched application<commit_after><?php

class AppTest extends PHPUnit_Framework_TestCase 
{
    /**
     * Member variable that will hold the Magento Application
     *
     * @var Mage_Core_App
     **/
    protected $_app;
    
    /**
     * Setup the dependencies for testing Mage_Core_App
     *
     * @return void
     * @author <NAME>
     **/
    public function setUp()
    {
        $this->_app = Mage::app();
    }
    
    /**
     * Tear down the dependencies and reset state
     *
     * @return void
     * @author <NAME>
     **/
    public function tearDown()
    {
        unset(
            $this->_app
        );
        Mage::reset();
    }
    
    /**
     * mageCoreAppHasBeenPatched
     * @author <NAME>
     * @test
     */
    public function mageCoreAppHasBeenPatched()
    {
        $this->assertInstanceOf(
            'Mage_Core_Model_App', 
            $this->_app, 
            "The application is of the wrong class"
        );
    } // mageCoreAppHasBeenPatched
    
    /**
     * mageCoreAppHasSetRequestMethod
     * @author <NAME>
     * @test
     */
    public function mageCoreAppHasSetRequestMethod()
    {
        $this->assertTrue( 
            method_exists($this->_app, 'setRequest'), 
            "The Mage_Core_Model_App does not have a setRequest method"
        );
    } // mageCoreAppHasSetRequestMethod
    
    /**
     * mageCoreAppSetRequestUpdatesInternalRequest
     * @author <NAME>
     * @depends mageCoreAppHasSetRequestMethod
     * @test
     */
    public function mageCoreAppSetRequestUpdatesInternalRequest()
    {
        // Inject an alternate request class
        $this->_app->setRequest(new Ibuildings_Mage_Controller_Request_HttpTestCase);
        
        $this->assertInstanceOf(
            'Ibuildings_Mage_Controller_Request_HttpTestCase',
            $this->_app->getRequest(),
            "The wrong request object is returned"
        );
    } // mageCoreAppSetRequestUpdatesInternalRequest
    
    /**
     * mageCoreAppGetRequestStillCreatesDependency
     * @author <NAME>
     * @test
     */
    public function mageCoreAppGetRequestStillCreatesDependency()
    {
        $this->assertInstanceOf(
            'Mage_Core_Controller_Request_Http',
            $this->_app->getRequest(),
            "The wrong request object is returned"
        );
    } // mageCoreAppGetRequestStillCreatesDependency
    
    /**
     * mageCoreAppHasSetResponseMethod
     * @author <NAME>
     * @test
     */
    public function mageCoreAppHasSetResponseMethod()
    {
        $this->assertTrue( 
            method_exists($this->_app, 'setResponse'), 
            "The Mage_Core_Model_App does not have a setResponse method"
        );
    } // mageCoreAppHasSetResponseMethod
    
    /**
     * mageCoreAppSetResponseUpdatesInternameResponse
     * @author <NAME>
     * @depends mageCoreAppHasSetResponseMethod
     * @test
     */
    public function mageCoreAppSetResponseUpdatesInternameResponse()
    {
        // Inject an alternate request class
        $this->_app->setResponse(new Ibuildings_Mage_Controller_Response_HttpTestCase);
        
        $this->assertInstanceOf(
            'Ibuildings_Mage_Controller_Response_HttpTestCase',
            $this->_app->getResponse(),
            "The wrong response object is returned"
        );
    } // mageCoreAppSetResponseUpdatesInternameResponse
    
    /**
     * mageCoreAppGetResponseStillCreatesDependency
     * @author <NAME>
     * @test
     */
    public function mageCoreAppGetResponseStillCreatesDependency()
    {
        $this->assertInstanceOf(
            'Mage_Core_Controller_Response_Http',
            $this->_app->getResponse(),
            "The wrong response object is returned"
        );
    } // mageCoreAppGetResponseStillCreatesDependency
    
}
{'fraction_non_alphanumeric': 0.09123804600672009, 'fraction_numerical': 0.0, 'mean_word_length': 2.185185185185185, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 36, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3516830', 'n_tokens_mistral': 1099, 'n_tokens_neox': 1084, 'n_words': 197}