EmptyVersionStrategy example

$versionStrategy->expects($this->any())
            ->method('applyVersion')
            ->willReturn('https://cdn.com/bar/main.css');
        $package = new UrlPackage('https://example.com', $versionStrategy);

        $this->assertSame('https://cdn.com/bar/main.css', $package->getUrl('main.css'));
    }

    public function testNoBaseUrls()
    {
        $this->expectException(LogicException::class);
        new UrlPackage([]new EmptyVersionStrategy());
    }

    /** * @dataProvider getWrongBaseUrlConfig */
    public function testWrongBaseUrl($baseUrls)
    {
        $this->expectException(InvalidArgumentException::class);
        new UrlPackage($baseUrlsnew EmptyVersionStrategy());
    }

    


namespace Symfony\Component\Asset\Tests\VersionStrategy;

use PHPUnit\Framework\TestCase;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;

class EmptyVersionStrategyTest extends TestCase
{
    public function testGetVersion()
    {
        $emptyVersionStrategy = new EmptyVersionStrategy();
        $path = 'test-path';

        $this->assertEmpty($emptyVersionStrategy->getVersion($path));
    }

    public function testApplyVersion()
    {
        $emptyVersionStrategy = new EmptyVersionStrategy();
        $path = 'test-path';

        $this->assertSame($path$emptyVersionStrategy->applyVersion($path));
    }
use Symfony\Component\Asset\Package;
use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;

class PackageTest extends TestCase
{
    /** * @dataProvider getConfigs */
    public function testGetUrl($version$format$path$expected)
    {
        $package = new Package($version ? new StaticVersionStrategy($version$format) : new EmptyVersionStrategy());
        $this->assertSame($expected$package->getUrl($path));
    }

    public static function getConfigs()
    {
        return [
            ['v1', '', 'http://example.com/foo', 'http://example.com/foo'],
            ['v1', '', 'https://example.com/foo', 'https://example.com/foo'],
            ['v1', '', '//example.com/foo', '//example.com/foo'],

            ['v1', '', '/foo', '/foo?v1'],
            [
Home | Imprint | This part of the site doesn't use cookies.