-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from wilr/master
fix: resolve regression with customBasePath (#22)
- Loading branch information
Showing
8 changed files
with
124 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
ci: | ||
name: CI | ||
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 | ||
with: | ||
dynamic_matrix: false | ||
extra_jobs: | | ||
- php: '8.1' | ||
db: mysql80 | ||
phpunit: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/public | ||
/vendor | ||
composer.lock | ||
.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset name="SilverStripe"> | ||
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description> | ||
|
||
<!-- base rules are PSR-2 --> | ||
<rule ref="PSR2" > | ||
<!-- Current exclusions --> | ||
<exclude name="PSR1.Methods.CamelCapsMethodName" /> | ||
</rule> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true"> | ||
<testsuite name="Default"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
<coverage cacheDirectory="./" | ||
includeUncoveredFiles="true" | ||
processUncoveredFiles="true" | ||
ignoreDeprecatedCodeUnits="true"> | ||
<include> | ||
<directory suffix=".php">src</directory> | ||
</include> | ||
</coverage> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace StevieMayhew\SilverStripeSVG\Tests; | ||
|
||
use SilverStripe\Dev\SapphireTest; | ||
use StevieMayhew\SilverStripeSVG\SVGTemplate; | ||
|
||
class SVGTemplateTest extends SapphireTest | ||
{ | ||
public static function setUpBeforeClass(): void | ||
{ | ||
parent::setUpBeforeClass(); | ||
|
||
// Set the base path to the test SVGs | ||
SVGTemplate::config()->set('base_path', 'tests'); | ||
} | ||
|
||
|
||
public function testFullSvgPathForTemplate() | ||
{ | ||
$svgTemplate = new SVGTemplate('logo.svg'); | ||
$this->assertStringEndsWith('logo.svg', $svgTemplate->fullSvgPathForTemplate()); | ||
|
||
$svgTemplate = $svgTemplate->customBasePath('custom'); | ||
$this->assertStringEndsWith('custom/logo.svg', $svgTemplate->fullSvgPathForTemplate()); | ||
} | ||
|
||
|
||
public function testIsRemoteSvg() | ||
{ | ||
$svgTemplate = new SVGTemplate('logo.svg'); | ||
$this->assertFalse($svgTemplate->isRemoteSvg()); | ||
|
||
$svgTemplate = new SVGTemplate('https://example.com/logo.svg'); | ||
$this->assertTrue($svgTemplate->isRemoteSvg()); | ||
|
||
|
||
$svgTemplate = new SVGTemplate('//example.com/logo.svg'); | ||
$this->assertTrue($svgTemplate->isRemoteSvg()); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.