Replace 'palletes' with 'colours' which is a bit more intuitive and is also spelt correctly.
This commit is contained in:
@@ -48,7 +48,7 @@ class ConfigurationTest extends TestCase
|
||||
'./',
|
||||
],
|
||||
|
||||
'palletes' => [
|
||||
'colours' => [
|
||||
'primary' => [
|
||||
'fill' => 'fill-primary',
|
||||
'stroke' => 'stroke-primary',
|
||||
|
||||
@@ -6,14 +6,14 @@ namespace Pcm\IconBundle\Tests\Twig\Functions;
|
||||
|
||||
use Pcm\IconBundle\Twig\Functions\IconExtension;
|
||||
use Pcm\IconBundle\Twig\Functions\IconNotFound;
|
||||
use Pcm\IconBundle\Twig\Functions\PalleteNotFound;
|
||||
use Pcm\IconBundle\Twig\Functions\ColourNotFound;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class IconExtensionTest extends TestCase
|
||||
{
|
||||
private const ICON = 'test';
|
||||
|
||||
private const PALLETES = [
|
||||
private const COLOURS = [
|
||||
'primary' => [
|
||||
'fill' => 'fill-primary',
|
||||
'stroke' => 'stroke-primary',
|
||||
@@ -39,7 +39,7 @@ class IconExtensionTest extends TestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->icon = new IconExtension(['tests/icons'], self::PALLETES);
|
||||
$this->icon = new IconExtension(['tests/icons'], self::COLOURS);
|
||||
}
|
||||
|
||||
public function testInstanceOf(): void
|
||||
@@ -151,19 +151,19 @@ class IconExtensionTest extends TestCase
|
||||
$this->assertSame(1, $timesMatched);
|
||||
}
|
||||
|
||||
public function testThrowsIfPalletsIsEmpty(): void
|
||||
public function testThrowsIfColoursIsEmpty(): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
new IconExtension(['/'], []);
|
||||
}
|
||||
|
||||
public function testThrowsIfPalletesContainsNonArray(): void
|
||||
public function testThrowsIfColoursContainsNonArray(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
new IconExtension(['/'], [99]);
|
||||
}
|
||||
|
||||
public function testThrowsIfPalletesContainsNonArrayInbetweenArrays(): void
|
||||
public function testThrowsIfColoursContainsNonArrayInbetweenArrays(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
new IconExtension(['/'], [[], 99, []]);
|
||||
@@ -241,26 +241,26 @@ class IconExtensionTest extends TestCase
|
||||
$this->assertDoesNotMatchRegularExpression('/fill:\s*rgb\(0,\s*0,\s*0\)\s*/', $content);
|
||||
}
|
||||
|
||||
public function testThrowsIfColourPalleteIsNotFound(): void
|
||||
public function testThrowsIfColourIsNotFound(): void
|
||||
{
|
||||
$this->expectException(PalleteNotFound::class);
|
||||
$this->expectException(ColourNotFound::class);
|
||||
$this->icon->renderIcon(['icon' => self::ICON, 'colour' => 'red']);
|
||||
}
|
||||
|
||||
public function testSvgClassContainsPalleteClasses(): void
|
||||
public function testSvgClassContainsColourClasses(): void
|
||||
{
|
||||
$contents = $this->icon->renderIcon(['icon' => self::ICON, 'colour' => 'white']);
|
||||
$this->assertMatchesRegularExpression('/<svg.*?class=".*?fill-white.*?>/', $contents);
|
||||
$this->assertMatchesRegularExpression('/<svg.*?class=".*?stroke-white?.*>/', $contents);
|
||||
}
|
||||
|
||||
public function testThrowsIfHoverPalleteIsNotFound(): void
|
||||
public function testThrowsIfHoverColourIsNotFound(): void
|
||||
{
|
||||
$this->expectException(PalleteNotFound::class);
|
||||
$this->expectException(ColourNotFound::class);
|
||||
$this->icon->renderIcon(['icon' => self::ICON, 'hover' => 'red']);
|
||||
}
|
||||
|
||||
public function testSvgClassContainsHoverPalleteClasses(): void
|
||||
public function testSvgClassContainsHoverColourClasses(): void
|
||||
{
|
||||
$contents = $this->icon->renderIcon(['icon' => self::ICON, 'hover' => 'white']);
|
||||
$this->assertMatchesRegularExpression('/<svg.+class=".*cursor-pointer.*".*>/', $contents);
|
||||
@@ -270,7 +270,7 @@ class IconExtensionTest extends TestCase
|
||||
$this->assertMatchesRegularExpression('/<svg.+class=".*group-hover:stroke-white.*".*>/', $contents);
|
||||
}
|
||||
|
||||
public function testSvgClassContainsHoverAndColourPalleteClasses(): void
|
||||
public function testSvgClassContainsHoverAndColourClasses(): void
|
||||
{
|
||||
$contents = $this->icon->renderIcon(['icon' => self::ICON, 'hover' => 'white', 'colour' => 'primary']);
|
||||
$this->assertMatchesRegularExpression('/<svg.+class=".*fill-primary.*".*>/', $contents);
|
||||
|
||||
Reference in New Issue
Block a user