Skip to content

Commit

Permalink
Add spritesheet helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mbardelmeijer committed Jul 22, 2020
1 parent 1677895 commit b9ef87b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<?php

use Enflow\Svg\Svg;
use Enflow\Svg\Spritesheet;

if (!function_exists('svg')) {
function svg(string $name): Svg
{
return new Svg($name);
}
}

if (!function_exists('spritesheet')) {
function spritesheet(): Spritesheet
{
return app(Spritesheet::class);
}
}
7 changes: 7 additions & 0 deletions tests/SpritesheetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public function test_spritesheet()
$this->assertCount(1, app(Spritesheet::class));
}

public function test_spritesheet_helper()
{
svg('clock')->render();

$this->assertCount(1, spritesheet());
}

public function test_that_svg_is_only_once_in_spritesheet()
{
svg('clock')->render();
Expand Down

0 comments on commit b9ef87b

Please sign in to comment.