BrowscapTest\Data\ExpanderTest::testParseOnNotEmptyDatacollectionWithChildren PHP Method

testParseOnNotEmptyDatacollectionWithChildren() public method

tests parsing an not empty data collection with children
    public function testParseOnNotEmptyDatacollectionWithChildren()
    {
        $collection = $this->getMockBuilder(\Browscap\Data\DataCollection::class)->disableOriginalConstructor()->setMethods(['getDivisions', 'getDefaultProperties'])->getMock();
        $collection->expects(self::never())->method('getDivisions')->will(self::returnValue([]));
        $division = $this->getMockBuilder(\Browscap\Data\Division::class)->disableOriginalConstructor()->setMethods(['getUserAgents'])->getMock();
        $division->expects(self::once())->method('getUserAgents')->will(self::returnValue([0 => ['properties' => ['avd' => 'xyz']]]));
        $collection->expects(self::once())->method('getDefaultProperties')->will(self::returnValue($division));
        $uaData = [0 => ['userAgent' => 'abc', 'properties' => ['Parent' => 'Defaultproperties', 'Version' => '1.0', 'MajorVer' => 1, 'Browser' => 'xyz'], 'children' => [0 => ['match' => 'abc*', 'properties' => ['Browser' => 'xyza']]]]];
        $division = $this->getMockBuilder(\Browscap\Data\Division::class)->disableOriginalConstructor()->setMethods(['getUserAgents'])->getMock();
        $division->expects(self::once())->method('getUserAgents')->will(self::returnValue($uaData));
        $this->object->setLogger($this->logger);
        self::assertSame($this->object, $this->object->setDataCollection($collection));
        $result = $this->object->expand($division, 'TestDivision');
        self::assertInternalType('array', $result);
        self::assertCount(2, $result);
    }