-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:/PhpGt/DomTemplate
- Loading branch information
Showing
5 changed files
with
87 additions
and
0 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
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
8 changes: 8 additions & 0 deletions
8
test/phpunit/TestHelper/Model/ArrayIterator/Product/Product.php
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,8 @@ | ||
<?php | ||
namespace Gt\DomTemplate\Test\TestHelper\Model\ArrayIterator\Product; | ||
|
||
class Product { | ||
public function __construct( | ||
public readonly string $name | ||
) {} | ||
} |
25 changes: 25 additions & 0 deletions
25
test/phpunit/TestHelper/Model/ArrayIterator/Product/ProductList.php
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,25 @@ | ||
<?php | ||
namespace Gt\DomTemplate\Test\TestHelper\Model\ArrayIterator\Product; | ||
|
||
use ArrayIterator; | ||
|
||
class ProductList extends ArrayIterator { | ||
/** | ||
* @param array<string> $categoryNameList | ||
* @param array<array<string>> $productNameList | ||
*/ | ||
public function __construct(array $categoryNameList, array $productNameList) { | ||
/** @var array<string, array<Product>> $categorisedProducts */ | ||
$categorisedProducts = []; | ||
|
||
foreach($categoryNameList as $i => $categoryName) { | ||
$categorisedProducts[$categoryName] = []; | ||
|
||
foreach($productNameList[$i] as $productName) { | ||
array_push($categorisedProducts[$categoryName], new Product($productName)); | ||
} | ||
} | ||
|
||
parent::__construct($categorisedProducts); | ||
} | ||
} |