Skip to content

Commit

Permalink
chore: Use a dedicated SVG\Tests namespace (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
smnandre authored Mar 28, 2024
1 parent 51251be commit e62e8ed
Show file tree
Hide file tree
Showing 42 changed files with 182 additions and 84 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"autoload-dev": {
"psr-4": {
"SVG\\": "tests/"
"SVG\\Tests\\": "tests/"
}
}
}
6 changes: 4 additions & 2 deletions tests/Nodes/Embedded/SVGImageTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

namespace SVG\Nodes\Embedded;
namespace SVG\Tests\Nodes\Embedded;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Embedded\SVGImage;
use SVG\Rasterization\SVGRasterizer;

/**
Expand All @@ -10,7 +12,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGImageTest extends \PHPUnit\Framework\TestCase
class SVGImageTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
7 changes: 5 additions & 2 deletions tests/Nodes/SVGNodeContainerTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?php

namespace SVG\Nodes;
namespace SVG\Tests\Nodes;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\SVGNode;
use SVG\Nodes\SVGNodeContainer;
use SVG\Rasterization\SVGRasterizer;

class SVGNodeContainerSubclass extends SVGNodeContainer
Expand All @@ -16,7 +19,7 @@ class SVGNodeContainerSubclass extends SVGNodeContainer
*
* @SuppressWarnings(PHPMD)
*/
class SVGNodeContainerTest extends \PHPUnit\Framework\TestCase
class SVGNodeContainerTest extends TestCase
{
/**
* @covers ::addChild
Expand Down
7 changes: 5 additions & 2 deletions tests/Nodes/SVGNodeTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

namespace SVG\Nodes;
namespace SVG\Tests\Nodes;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\SVGNode;

class SVGNodeSubclass extends SVGNode
{
Expand All @@ -21,7 +24,7 @@ public function rasterize(\SVG\Rasterization\SVGRasterizer $rasterizer): void
*
* @SuppressWarnings(PHPMD)
*/
class SVGNodeTest extends \PHPUnit\Framework\TestCase
class SVGNodeTest extends TestCase
{
/**
* @covers ::getName
Expand Down
8 changes: 5 additions & 3 deletions tests/Nodes/Shapes/SVGCircleTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

namespace SVG\Nodes\Shapes;
namespace SVG\Tests\Nodes\Shapes;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Shapes\SVGCircle;
use SVG\Rasterization\SVGRasterizer;

/**
Expand All @@ -10,9 +12,9 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGCircleTest extends \PHPUnit\Framework\TestCase
class SVGCircleTest extends TestCase
{
/**
/**
* @covers ::__construct
*/
public function test__construct(): void
Expand Down
6 changes: 4 additions & 2 deletions tests/Nodes/Shapes/SVGEllipseTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

namespace SVG\Nodes\Shapes;
namespace SVG\Tests\Nodes\Shapes;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Shapes\SVGEllipse;
use SVG\Rasterization\SVGRasterizer;

/**
Expand All @@ -10,7 +12,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGEllipseTest extends \PHPUnit\Framework\TestCase
class SVGEllipseTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
6 changes: 4 additions & 2 deletions tests/Nodes/Shapes/SVGLineTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

namespace SVG\Nodes\Shapes;
namespace SVG\Tests\Nodes\Shapes;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Shapes\SVGLine;
use SVG\Rasterization\SVGRasterizer;

/**
Expand All @@ -10,7 +12,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGLineTest extends \PHPUnit\Framework\TestCase
class SVGLineTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
6 changes: 4 additions & 2 deletions tests/Nodes/Shapes/SVGPathTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

namespace SVG\Nodes\Shapes;
namespace SVG\Tests\Nodes\Shapes;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Shapes\SVGPath;
use SVG\Rasterization\SVGRasterizer;

/**
Expand All @@ -10,7 +12,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGPathTest extends \PHPUnit\Framework\TestCase
class SVGPathTest extends TestCase
{
private static $sampleDescription = 'M100,100 h20 Z M200,200 h20';
private static $sampleCommands = [
Expand Down
6 changes: 4 additions & 2 deletions tests/Nodes/Shapes/SVGPolygonTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

namespace SVG\Nodes\Shapes;
namespace SVG\Tests\Nodes\Shapes;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Shapes\SVGPolygon;
use SVG\Rasterization\SVGRasterizer;

/**
Expand All @@ -10,7 +12,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGPolygonTest extends \PHPUnit\Framework\TestCase
class SVGPolygonTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
7 changes: 5 additions & 2 deletions tests/Nodes/Shapes/SVGPolygonalShapeTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

namespace SVG\Nodes\Shapes;
namespace SVG\Tests\Nodes\Shapes;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Shapes\SVGPolygonalShape;

/**
* @SuppressWarnings(PHPMD)
Expand All @@ -25,7 +28,7 @@ public function rasterize(\SVG\Rasterization\SVGRasterizer $rasterizer): void
*
* @SuppressWarnings(PHPMD)
*/
class SVGPolygonalShapeTest extends \PHPUnit\Framework\TestCase
class SVGPolygonalShapeTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
6 changes: 4 additions & 2 deletions tests/Nodes/Shapes/SVGPolylineTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

namespace SVG\Nodes\Shapes;
namespace SVG\Tests\Nodes\Shapes;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Shapes\SVGPolyline;
use SVG\Rasterization\SVGRasterizer;

/**
Expand All @@ -10,7 +12,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGPolylineTest extends \PHPUnit\Framework\TestCase
class SVGPolylineTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
6 changes: 4 additions & 2 deletions tests/Nodes/Shapes/SVGRectTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

namespace SVG\Nodes\Shapes;
namespace SVG\Tests\Nodes\Shapes;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Shapes\SVGRect;
use SVG\Rasterization\SVGRasterizer;

/**
Expand All @@ -10,7 +12,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGRectTest extends \PHPUnit\Framework\TestCase
class SVGRectTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
6 changes: 4 additions & 2 deletions tests/Nodes/Structures/SVGDefsTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

namespace SVG\Nodes\Structures;
namespace SVG\Tests\Nodes\Structures;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Structures\SVGDefs;
use SVG\Nodes\SVGNode;
use SVG\Rasterization\SVGRasterizer;

Expand All @@ -11,7 +13,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGDefsTest extends \PHPUnit\Framework\TestCase
class SVGDefsTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
6 changes: 4 additions & 2 deletions tests/Nodes/Structures/SVGDocumentFragmentTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

namespace SVG\Nodes\Structures;
namespace SVG\Tests\Nodes\Structures;

use AssertGD\GDSimilarityConstraint;
use PHPUnit\Framework\TestCase;
use SVG\Nodes\Structures\SVGDocumentFragment;
use SVG\Nodes\SVGNode;
use SVG\Nodes\SVGNodeContainer;

Expand All @@ -12,7 +14,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGDocumentFragmentTest extends \PHPUnit\Framework\TestCase
class SVGDocumentFragmentTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
6 changes: 4 additions & 2 deletions tests/Nodes/Structures/SVGScriptTest.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?php

namespace SVG\Nodes\Structures;
namespace SVG\Tests\Nodes\Structures;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Structures\SVGScript;
use SVG\Rasterization\SVGRasterizer;

/**
* @coversDefaultClass \SVG\Nodes\Structures\SVGScript
*
* @SuppressWarnings(PHPMD)
*/
class SVGScriptTest extends \PHPUnit\Framework\TestCase
class SVGScriptTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
6 changes: 4 additions & 2 deletions tests/Nodes/Structures/SVGStyleTest.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?php

namespace SVG\Nodes\Structures;
namespace SVG\Tests\Nodes\Structures;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Structures\SVGStyle;
use SVG\Rasterization\SVGRasterizer;

/**
* @coversDefaultClass \SVG\Nodes\Structures\SVGStyle
*
* @SuppressWarnings(PHPMD)
*/
class SVGStyleTest extends \PHPUnit\Framework\TestCase
class SVGStyleTest extends TestCase
{
/**
* @covers ::__construct
Expand Down
8 changes: 5 additions & 3 deletions tests/Nodes/Texts/SVGTextTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php

namespace SVG\Nodes\Texts;
namespace SVG\Tests\Nodes\Texts;

use PHPUnit\Framework\TestCase;
use SVG\Nodes\Texts\SVGText;
use SVG\Rasterization\SVGRasterizer;

/**
Expand All @@ -10,7 +12,7 @@
*
* @SuppressWarnings(PHPMD)
*/
class SVGTextTest extends \PHPUnit\Framework\TestCase
class SVGTextTest extends TestCase
{
/**
* @covers ::rasterize
Expand All @@ -28,7 +30,7 @@ public function testRasterizeShouldHaveDefaultFontSize(): void
// should call image renderer with correct options
$rast->expects($this->once())->method('render')->with(
$this->identicalTo('text'),
$this->callback(fn($options) => isset($options['fontSize']) && $options['fontSize'] === 16),
$this->callback(fn ($options) => isset($options['fontSize']) && $options['fontSize'] === 16),
$this->identicalTo($obj)
);
$obj->rasterize($rast);
Expand Down
7 changes: 5 additions & 2 deletions tests/Rasterization/Path/ArcApproximatorTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?php

namespace SVG\Rasterization\Path;
namespace SVG\Tests\Rasterization\Path;

use PHPUnit\Framework\TestCase;
use SVG\Rasterization\Path\ArcApproximator;

/**
* @covers \SVG\Rasterization\Path\ArcApproximator
*
* @SuppressWarnings(PHPMD)
*/
class ArcApproximatorTest extends \PHPUnit\Framework\TestCase
class ArcApproximatorTest extends TestCase
{
public function testApproximate(): void
{
Expand Down
7 changes: 5 additions & 2 deletions tests/Rasterization/Path/BezierApproximatorTest.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
<?php

namespace SVG\Rasterization\Path;
namespace SVG\Tests\Rasterization\Path;

use PHPUnit\Framework\TestCase;
use SVG\Rasterization\Path\BezierApproximator;

/**
* @covers \SVG\Rasterization\Path\BezierApproximator
*
* @SuppressWarnings(PHPMD)
*/
class BezierApproximatorTest extends \PHPUnit\Framework\TestCase
class BezierApproximatorTest extends TestCase
{
public function testQuadratic(): void
{
Expand Down
Loading

0 comments on commit e62e8ed

Please sign in to comment.