# wp-optimize/3.2.5/vendor/kriswallsmith/assetic/tests/Assetic/Test/AssetManagerTest.php

WP-Optimize – Cache, Compress images, Minify &amp; Clean database to boost page speed &amp; performance, version 3.2.5. 63 lines.

- Page: https://pluginprobe.com/plugins/wp-optimize/3.2.5/code/vendor/kriswallsmith/assetic/tests/Assetic/Test/AssetManagerTest.php
- Raw: https://pluginprobe.com/plugins/wp-optimize/3.2.5/raw/vendor/kriswallsmith/assetic/tests/Assetic/Test/AssetManagerTest.php
- Modified: 2022-06-03T18:20:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wp-optimize/3.2.5/code/vendor/kriswallsmith/assetic/tests/Assetic/Test/AssetManagerTest.php#L10-L20`.

```php
<?php

/*
 * This file is part of the Assetic package, an OpenSky project.
 *
 * (c) 2010-2014 OpenSky Project Inc
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Assetic\Test;

use Assetic\AssetManager;

class AssetManagerTest extends \PHPUnit_Framework_TestCase
{
    /** @var AssetManager */
    private $am;

    protected function setUp()
    {
        $this->am = new AssetManager();
    }

    public function testGetAsset()
    {
        $asset = $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock();
        $this->am->set('foo', $asset);
        $this->assertSame($asset, $this->am->get('foo'), '->get() returns an asset');
    }

    public function testGetInvalidAsset()
    {
        $this->setExpectedException('InvalidArgumentException');
        $this->am->get('foo');
    }

    public function testHas()
    {
        $asset = $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock();
        $this->am->set('foo', $asset);

        $this->assertTrue($this->am->has('foo'), '->has() returns true if the asset is set');
        $this->assertFalse($this->am->has('bar'), '->has() returns false if the asset is not set');
    }

    public function testInvalidName()
    {
        $this->setExpectedException('InvalidArgumentException');

        $this->am->set('@foo', $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock());
    }

    public function testClear()
    {
        $this->am->set('foo', $this->getMockBuilder('Assetic\Asset\AssetInterface')->getMock());
        $this->am->clear();

        $this->assertFalse($this->am->has('foo'));
    }
}

```
