NerdsAndCompany\Schematic\Services\UserGroupsTest::getMockSections PHP Метод

getMockSections() приватный Метод

private getMockSections ( string $indexBy, integer $count ) : PHPUnit_Framework_MockObject_MockObject[] | Craft\SectionModel[]
$indexBy string
$count integer
Результат PHPUnit_Framework_MockObject_MockObject[] | Craft\SectionModel[]
    private function getMockSections($indexBy, $count)
    {
        $keyPrefix = $indexBy == 'id' ? '' : 'sectionHandle';
        $mockSections = [];
        for ($x = 0; $x <= $count; ++$x) {
            $mockSection = $this->getMockBuilder(SectionModel::class)->disableOriginalConstructor()->getMock();
            $mockSection->expects($this->any())->method('__get')->willReturnMap([['handle', 'sectionHandle' . $x], ['id', $x], ['name', 'sectionName' . $x]]);
            $mockSections[$keyPrefix . $x] = $mockSection;
        }
        return $mockSections;
    }