| 1 | <?php |
||
| 5 | class ModelTreeTest extends TestCase |
||
| 6 | { |
||
| 7 | public function setUp() |
||
| 8 | { |
||
| 9 | parent::setUp(); |
||
| 10 | } |
||
| 11 | |||
| 12 | public function testSelectOptions() |
||
| 13 | { |
||
| 14 | $rootText = 'Root Text'; |
||
| 15 | |||
| 16 | $options = Tree::selectOptions(function ($query) { |
||
| 17 | return $query->where('uri', ''); |
||
| 18 | }, $rootText); |
||
| 19 | |||
| 20 | $count = Tree::query()->where('uri', '')->count(); |
||
| 21 | |||
| 22 | $this->assertEquals(array_shift($options), $rootText); |
||
| 23 | $this->assertEquals(count($options), $count); |
||
| 24 | } |
||
| 25 | } |
||
| 26 |