2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
2024-09-26 06:16:04 +02:00
|
|
|
namespace SilverStripe\View\Tests\SSTemplateEngineTest;
|
2016-10-14 03:30:05 +02:00
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
2024-09-23 04:31:50 +02:00
|
|
|
use SilverStripe\Model\List\ArrayList;
|
|
|
|
use SilverStripe\Model\ModelData;
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2024-09-23 04:31:50 +02:00
|
|
|
class LevelTestData extends ModelData implements TestOnly
|
2016-10-14 03:30:05 +02:00
|
|
|
{
|
2016-12-16 05:34:21 +01:00
|
|
|
protected $depth;
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function __construct($depth = 1)
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->depth = $depth;
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function output($val)
|
|
|
|
{
|
|
|
|
return "$this->depth-$val";
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function forLoop($number)
|
|
|
|
{
|
2020-04-20 19:58:09 +02:00
|
|
|
$ret = [];
|
2016-12-16 05:34:21 +01:00
|
|
|
for ($i = 0; $i < (int)$number; ++$i) {
|
|
|
|
$ret[] = new TestObject("!$i");
|
|
|
|
}
|
|
|
|
return new ArrayList($ret);
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
|
2016-12-16 05:34:21 +01:00
|
|
|
public function forWith($number)
|
|
|
|
{
|
2024-06-17 23:37:39 +02:00
|
|
|
return new LevelTestData($number);
|
2016-12-16 05:34:21 +01:00
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|