<commit_before><?php
namespace Bolt\Tests;
use Bolt\Application;
use Bolt\Configuration\ResourceManager;
use Bolt\Configuration\ComposerResources;
use Symfony\Component\HttpFoundation\Request;


/**
 * Class to test correct operation and locations of resource manager class and extensions.
 *
 * @author <NAME> <<EMAIL>>
 **/


class ResourceManagerTest extends \PHPUnit_Framework_TestCase
{
    
    
    public function setup()
    {
        
    }
    
    public function testConstruction()
    {
        $config = new ResourceManager(__DIR__);
        $this->assertEquals(\PHPUnit_Framework_Assert::readAttribute($config, 'root'), __DIR__);
    }
    
    public function testDefaultPaths()
    {
        $config = new ResourceManager(__DIR__);
        $this->assertEquals(__DIR__,                    $config->getPath("rootpath"));
        $this->assertEquals(__DIR__."/app",             $config->getPath("apppath"));
        $this->assertEquals(__DIR__."/app/extensions",  $config->getPath("extensionspath"));
        $this->assertEquals(__DIR__."/files",           $config->getPath("filespath"));
        $this->assertEquals(__DIR__,                    $config->getPath("web"));
        $this->assertEquals(__DIR__."/app/cache",       $config->getPath("cache"));
        $this->assertEquals(__DIR__."/app/config",      $config->getPath("config"));
    }
    
    public function testShorAliasedPaths()
    {
        $config = new ResourceManager(__DIR__);
        $this->assertEquals(__DIR__,            $config->getPath("root"));
        $this->assertEquals(__DIR__."/app",     $config->getPath("app"));
        $this->assertEquals(__DIR__."/files",   $config->getPath("files"));
    }
    
    public function testDefaultUrls()
    {
        $config = new ResourceManager(__DIR__);
        $this->assertEquals("/",                $config->getUrl("root"));
        $this->assertEquals("/app/",            $config->getUrl("app"));
        $this->assertEquals("/app/extensions/", $config->getUrl("extensions"));
        $this->assertEquals("/async/",          $config->getUrl("async"));
        $this->assertEquals("/bolt/",           $config->getUrl("bolt"));
        $this->assertEquals("/files/",          $config->getUrl("files"));
    }
    
    public function testBoltAppSetup()
    {
        $config = new ResourceManager(__DIR__);
        $app = new Application(array('resources'=>$config));
        $this->assertEquals($config->getPaths(), $app['resources']->getPaths());
        
        // Test that the Application has initialised the resources, injecting in config values.
        $this->assertContains(__DIR__."/theme",      $config->getPath("theme"));
        $this->assertNotEmpty($config->getUrl("canonical"));
    }
    
    public function testDefaultRequest()
    {
        $config = new ResourceManager(__DIR__);
        $app = new Application(array('resources'=>$config));
        $this->assertEquals("cli",                  $config->getRequest("protocol"));
        $this->assertEquals("bolt.dev",             $config->getRequest("hostname"));
        $this->assertEquals("cli://bolt.dev/bolt",  $config->getUrl("canonical"));
        $this->assertEquals("cli://bolt.dev",       $config->getUrl("host"));
        $this->assertEquals("cli://bolt.dev/",      $config->getUrl("root"));
    }
    
    public function testCustomRequest()
    {
        $request = Request::create(
            "/bolt/test/location",
            "GET",
            array(),
            array(),
            array(),
            array(
                'HTTP_HOST'=>'test.dev',
                'SERVER_PROTOCOL'=>'https'
            )  
        );
        $config = new ResourceManager(__DIR__, $request);
        $app = new Application(array('resources'=>$config));
        $this->assertEquals("https",                $config->getRequest("protocol"));
        $this->assertEquals("test.dev",             $config->getRequest("hostname"));
        $this->assertEquals("https://bolt.dev/bolt/test/location",  $config->getUrl("canonical"));
    }
    
    
}<commit_msg>added a couple more checks to make sure Composer Install is tested<commit_after><?php
namespace Bolt\Tests;
use Bolt\Application;
use Bolt\Configuration\ResourceManager;
use Bolt\Configuration\ComposerResources;
use Symfony\Component\HttpFoundation\Request;


/**
 * Class to test correct operation and locations of resource manager class and extensions.
 *
 * @author <NAME> <<EMAIL>>
 **/


class ResourceManagerTest extends \PHPUnit_Framework_TestCase
{
    
    
    public function setup()
    {
        
    }
    
    public function testConstruction()
    {
        $config = new ResourceManager(__DIR__);
        $this->assertEquals(\PHPUnit_Framework_Assert::readAttribute($config, 'root'), __DIR__);
    }
    
    public function testDefaultPaths()
    {
        $config = new ResourceManager(__DIR__);
        $this->assertEquals(__DIR__,                    $config->getPath("rootpath"));
        $this->assertEquals(__DIR__."/app",             $config->getPath("apppath"));
        $this->assertEquals(__DIR__."/app/extensions",  $config->getPath("extensionspath"));
        $this->assertEquals(__DIR__."/files",           $config->getPath("filespath"));
        $this->assertEquals(__DIR__,                    $config->getPath("web"));
        $this->assertEquals(__DIR__."/app/cache",       $config->getPath("cache"));
        $this->assertEquals(__DIR__."/app/config",      $config->getPath("config"));
    }
    
    public function testShorAliasedPaths()
    {
        $config = new ResourceManager(__DIR__);
        $this->assertEquals(__DIR__,            $config->getPath("root"));
        $this->assertEquals(__DIR__."/app",     $config->getPath("app"));
        $this->assertEquals(__DIR__."/files",   $config->getPath("files"));
    }
    
    public function testDefaultUrls()
    {
        $config = new ResourceManager(__DIR__);
        $this->assertEquals("/",                $config->getUrl("root"));
        $this->assertEquals("/app/",            $config->getUrl("app"));
        $this->assertEquals("/app/extensions/", $config->getUrl("extensions"));
        $this->assertEquals("/async/",          $config->getUrl("async"));
        $this->assertEquals("/bolt/",           $config->getUrl("bolt"));
        $this->assertEquals("/files/",          $config->getUrl("files"));
    }
    
    public function testBoltAppSetup()
    {
        $config = new ResourceManager(__DIR__);
        $app = new Application(array('resources'=>$config));
        $this->assertEquals($config->getPaths(), $app['resources']->getPaths());
        
        // Test that the Application has initialised the resources, injecting in config values.
        $this->assertContains(__DIR__."/theme",      $config->getPath("theme"));
        $this->assertNotEmpty($config->getUrl("canonical"));
    }
    
    public function testDefaultRequest()
    {
        $config = new ResourceManager(__DIR__);
        $app = new Application(array('resources'=>$config));
        $this->assertEquals("cli",                  $config->getRequest("protocol"));
        $this->assertEquals("bolt.dev",             $config->getRequest("hostname"));
        $this->assertEquals("cli://bolt.dev/bolt",  $config->getUrl("canonical"));
        $this->assertEquals("cli://bolt.dev",       $config->getUrl("host"));
        $this->assertEquals("cli://bolt.dev/",      $config->getUrl("root"));
    }
    
    public function testCustomRequest()
    {
        $request = Request::create(
            "/bolt/test/location",
            "GET",
            array(),
            array(),
            array(),
            array(
                'HTTP_HOST'=>'test.dev',
                'SERVER_PROTOCOL'=>'https'
            )  
        );
        $config = new ResourceManager(__DIR__, $request);
        $app = new Application(array('resources'=>$config));
        $this->assertEquals("https",                $config->getRequest("protocol"));
        $this->assertEquals("test.dev",             $config->getRequest("hostname"));
        $this->assertEquals("https://bolt.dev/bolt/test/location",  $config->getUrl("canonical"));
    }
    
    public function testComposerCustomConfig()
    {
        $config = new ComposerResources(__DIR__);
        $app = new Application(array('resources'=>$config));
        $this->assertEquals(__DIR__."/vendor/bolt/bolt/app",            $config->getPath("app"));
        $this->assertEquals(__DIR__."/vendor/bolt/bolt/app/extensions", $config->getPath("extensions"));
        $this->assertEquals("/bolt-public/",                            $config->getUrl("app"));
    }
    
    public function testCompatibilityConstants()
    {

    }
    
    
}
{'fraction_non_alphanumeric': 0.16718159972536903, 'fraction_numerical': 0.0, 'mean_word_length': 2.4918098282061525, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 138, 'https://': 2, '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': '6709805', 'n_tokens_mistral': 2308, 'n_tokens_neox': 2277, 'n_words': 357}