public function testSnippet()
{
$app = $this->getApp();
// Test snippet inserts at top of <head>
$response = new Response($this->template);
$app['asset.queue.snippet']->add($this->getSnippet(Target::START_OF_HEAD, '<meta name="test-snippet" />'));
$app['asset.queue.snippet']->process($this->getRequest(), $response);
$this->assertEquals($this->html($this->expectedStartOfHead), $this->html($response->getContent()));
// Test snippet inserts at end of <head>
$response = new Response($this->template);
$app['asset.queue.snippet']->clear();
$app['asset.queue.snippet']->add($this->getSnippet(Target::END_OF_HEAD, '<meta name="test-snippet" />'));
$app['asset.queue.snippet']->process($this->getRequest(), $response);
$this->assertEquals($this->html($this->expectedEndOfHead), $this->html($response->getContent()));
// Test snippet inserts at end of body
$response = new Response($this->template);
$app['asset.queue.snippet']->clear();
$app['asset.queue.snippet']->add($this->getSnippet(Target::START_OF_BODY, '<p class="test-snippet"></p>'));
$app['asset.queue.snippet']->process($this->getRequest(), $response);
$this->assertEquals($this->html($this->expectedStartOfBody), $this->html($response->getContent()));
// Test snippet inserts at end of </html>
$response = new Response($this->template);
$app['asset.queue.snippet']->clear();
$app['asset.queue.snippet']->add($this->getSnippet(Target::END_OF_HTML, '<p class="test-snippet"></p>'));
$app['asset.queue.snippet']->process($this->getRequest(), $response);
$this->assertEquals($this->html($this->expectedEndOfHtml), $this->html($response->getContent()));
// Test snippet inserts before existing css
$response = new Response($this->template);
$app['asset.queue.snippet']->clear();
$app['asset.queue.snippet']->add($this->getSnippet(Target::BEFORE_CSS, '<meta name="test-snippet" />'));
$app['asset.queue.snippet']->process($this->getRequest(), $response);
$this->assertEquals($this->html($this->expectedBeforeCss), $this->html($response->getContent()));
// Test snippet inserts after existing css
$response = new Response($this->template);
$app['asset.queue.snippet']->clear();
$app['asset.queue.snippet']->add($this->getSnippet(Target::AFTER_CSS, '<meta name="test-snippet" />'));
$app['asset.queue.snippet']->process($this->getRequest(), $response);
$this->assertEquals($this->html($this->expectedAfterCss), $this->html($response->getContent()));
// Test snippet inserts after existing meta tags
$response = new Response($this->template);
$app['asset.queue.snippet']->clear();
$app['asset.queue.snippet']->add($this->getSnippet(Target::AFTER_META, '<meta name="test-snippet" />'));
$app['asset.queue.snippet']->process($this->getRequest(), $response);
$this->assertEquals($this->html($this->expectedAfterMeta), $this->html($response->getContent()));
}