Example #1
0
 public function setUp()
 {
     $this->css = new CSS(__DIR__, $this->createMock(ResourceMap::class), $this->createMock(Core::class));
     $this->css->prepare();
     ResourceValidator::$projectRoot = __DIR__ . '/';
     ResourceValidator::$webRoot = __DIR__ . '/www/';
     // Testing other deprecated functions here
     ResourceValidator::getWebRelativePath('test.jpg', __DIR__ . '/');
     $resourcePath = __DIR__ . '/test.jpg';
     file_put_contents($resourcePath, '/** TEST */');
 }
Example #2
0
<?php

/**
 * Created by Vitaly Iegorov <*****@*****.**>.
 * on 26.04.16 at 10:43
 */
use samsonphp\resource\ResourceValidator;
// Define this resource identifier
define('STATIC_RESOURCE_HANDLER', 'resourcer');
// Get current project web root directory
ResourceValidator::$webRoot = getcwd();
// Get current project root directory
ResourceValidator::$projectRoot = dirname(ResourceValidator::$webRoot);
/**
 * Static resource path builder.
 *
 * @deprecated Moving to use new samsonphp/view resource an $this->src() should be used
 *             in view file for generating paths to static resources
 *
 * @param string $path   Relative static resource resource path
 * @param null   $module Entity for path building, if not passed current resource is used
 *
 * @return string Static resource path
 * @throws \samsonphp\resource\exception\ResourceNotFound
 */
function src($path, $module = null)
{
    // Define resource
    switch (gettype($module)) {
        case 'string':
            // Find resource by identifier