Package example

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'],
            [
$this->assertSame($a$packages->getPackage('a'));

        $packages = new Packages($default['a' => $a]);

        $this->assertSame($default$packages->getPackage());
        $this->assertSame($a$packages->getPackage('a'));
    }

    public function testGetVersion()
    {
        $packages = new Packages(
            new Package(new StaticVersionStrategy('default')),
            ['a' => new Package(new StaticVersionStrategy('a'))]
        );

        $this->assertSame('default', $packages->getVersion('/foo'));
        $this->assertSame('a', $packages->getVersion('/foo', 'a'));
    }

    public function testGetUrl()
    {
        $packages = new Packages(
            new Package(new StaticVersionStrategy('default')),
            
/** * @internal * * @covers \Shopware\Core\Framework\Log\Package * * @package core */
class PackageTest extends TestCase
{
    public function testConstructor(): void
    {
        $package = new Package('test');
        static::assertSame('test', $package->package);
    }

    public function testNonExistingClass(): void
    {
        static::assertNull(Package::getPackageName('asdjkfljasdlkfjdas'));
    }

    public function testNoPackageAttribute(): void
    {
        static::assertNull(Package::getPackageName(NoPackage::class));
    }
Home | Imprint | This part of the site doesn't use cookies.