Skip to content

Commit

Permalink
Code consistency + return types
Browse files Browse the repository at this point in the history
  • Loading branch information
JuGid committed Feb 3, 2024
1 parent 680c6c4 commit 08c785f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":1,"defects":{"Jugid\\AutomaticBreadcrumbs\\Tests\\Attribute\\BreadcrumbAttributeTest::testShouldGetNamespace":7,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#0":7,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#3":7,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#4":7},"times":{"Jugid\\AutomaticBreadcrumbs\\Tests\\Attribute\\BreadcrumbAttributeTest::testShouldTestAttributeConstruction":0.002,"Jugid\\AutomaticBreadcrumbs\\Tests\\Attribute\\BreadcrumbAttributeTest::testShouldGetTitle":0.001,"Jugid\\AutomaticBreadcrumbs\\Tests\\Attribute\\BreadcrumbAttributeTest::testShouldGetRoot":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Attribute\\BreadcrumbAttributeTest::testShouldGetNamespace":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Model\\UrlBreadcrumbTest::testShouldTestBreadcrumbsModel":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldConstruct":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#0":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#1":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#2":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#3":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#4":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#5":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#6":0}}
{"version":1,"defects":{"Jugid\\AutomaticBreadcrumbs\\Tests\\Attribute\\BreadcrumbAttributeTest::testShouldGetNamespace":7,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#0":7,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#3":7,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#4":7},"times":{"Jugid\\AutomaticBreadcrumbs\\Tests\\Attribute\\BreadcrumbAttributeTest::testShouldTestAttributeConstruction":0.01,"Jugid\\AutomaticBreadcrumbs\\Tests\\Attribute\\BreadcrumbAttributeTest::testShouldGetTitle":0.002,"Jugid\\AutomaticBreadcrumbs\\Tests\\Attribute\\BreadcrumbAttributeTest::testShouldGetRoot":0.001,"Jugid\\AutomaticBreadcrumbs\\Tests\\Attribute\\BreadcrumbAttributeTest::testShouldGetNamespace":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Model\\UrlBreadcrumbTest::testShouldTestBreadcrumbsModel":0.002,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldConstruct":0.001,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#0":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#1":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#2":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#3":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#4":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#5":0,"Jugid\\AutomaticBreadcrumbs\\Tests\\Strategy\\HierarchyStrategyTest::testShouldDecomposeWithHierarchyStrategy#6":0}}
11 changes: 7 additions & 4 deletions tests/Unit/Attribute/BreadcrumbAttributeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,30 @@
class BreadcrumbAttributeTest extends TestCase
{

public function testShouldTestAttributeConstruction()
public function testShouldTestAttributeConstruction() : void
{
$this->expectNotToPerformAssertions();
$breadcrumb = new Breadcrumb('Title');
$breadcrumb = new Breadcrumb('Title', true);
$breadcrumb = new Breadcrumb('Title', true, 'default');
}

public function testShouldGetTitle() {
public function testShouldGetTitle() : void
{
$breadcrumb = new Breadcrumb('Title');
$this->assertEquals('Title', $breadcrumb->getTitle());
}

public function testShouldGetRoot() {
public function testShouldGetRoot() : void
{
$breadcrumb_false = new Breadcrumb('Title');
$breadcrumb_true = new Breadcrumb('Title', true);
$this->assertFalse($breadcrumb_false->isRoot());
$this->assertTrue($breadcrumb_true->isRoot());
}

public function testShouldGetNamespace() {
public function testShouldGetNamespace() : void
{
$breadcrumb_default = new Breadcrumb('Title');
$breadcrumb_with_specific_namespace = new Breadcrumb('Title', false, 'my_namespace');
$this->assertEquals('default', $breadcrumb_default->getNamespace());
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Model/UrlBreadcrumbTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class UrlBreadcrumbTest extends TestCase
{

public function testShouldTestBreadcrumbsModel()
public function testShouldTestBreadcrumbsModel() : void
{
$breadcrumb = new UrlBreadcrumb('My breadcrumb', '/my/breadcrumb/path');

Expand Down
8 changes: 5 additions & 3 deletions tests/Unit/Strategy/HierarchyStrategyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

class HierarchyStrategyTest extends TestCase {

public function testShouldConstruct() {
public function testShouldConstruct() : void
{
$this->expectNotToPerformAssertions();

$strategy = new HierarchyStrategy();
Expand All @@ -16,12 +17,13 @@ public function testShouldConstruct() {
/**
* @dataProvider pathExpectedProvider
*/
public function testShouldDecomposeWithHierarchyStrategy(string $path, array $expected) {
public function testShouldDecomposeWithHierarchyStrategy(string $path, array $expected) : void
{
$strategy = new HierarchyStrategy();
$this->assertEquals($expected, $strategy->decompose($path));
}

public static function pathExpectedProvider()
public static function pathExpectedProvider() : \Generator
{
yield ['path/to/page/', ['/path/to/page', '/path/to', '/path']];
yield ['path/to/page', ['/path/to/page', '/path/to', '/path']];
Expand Down

0 comments on commit 08c785f

Please sign in to comment.