BrowscapTest\Writer\IniWriterTest::testRenderSectionBodyIfNotSilent PHP Method

testRenderSectionBodyIfNotSilent() public method

tests rendering the body of one section
    public function testRenderSectionBodyIfNotSilent()
    {
        $this->object->setSilent(false);
        $section = ['Comment' => 1, 'Win16' => true, 'Platform' => 'bcd'];
        $expectedAgents = [0 => ['properties' => ['Comment' => 1, 'Win16' => true]]];
        $mockExpander = $this->getMockBuilder(\Browscap\Data\Expander::class)->disableOriginalConstructor()->setMethods(['trimProperty'])->getMock();
        $mockExpander->expects(self::any())->method('trimProperty')->will(self::returnArgument(0));
        self::assertSame($this->object, $this->object->setExpander($mockExpander));
        $division = $this->getMockBuilder(\Browscap\Data\Division::class)->disableOriginalConstructor()->setMethods(['getUserAgents'])->getMock();
        $division->expects(self::once())->method('getUserAgents')->will(self::returnValue($expectedAgents));
        $collection = $this->getMockBuilder(\Browscap\Data\DataCollection::class)->disableOriginalConstructor()->setMethods(['getDefaultProperties'])->getMock();
        $collection->expects(self::once())->method('getDefaultProperties')->will(self::returnValue($division));
        $mockFormatter = $this->getMockBuilder(\Browscap\Formatter\PhpFormatter::class)->disableOriginalConstructor()->setMethods(['formatPropertyName'])->getMock();
        $mockFormatter->expects(self::once())->method('formatPropertyName')->will(self::returnArgument(0));
        self::assertSame($this->object, $this->object->setFormatter($mockFormatter));
        $mockFilter = $this->getMockBuilder(\Browscap\Filter\FullFilter::class)->disableOriginalConstructor()->setMethods(['isOutputProperty'])->getMock();
        $map = [['Comment', $this->object, true], ['Win16', $this->object, false], ['Platform', $this->object, true]];
        $mockFilter->expects(self::exactly(2))->method('isOutputProperty')->will(self::returnValueMap($map));
        self::assertSame($this->object, $this->object->setFilter($mockFilter));
        self::assertSame($this->object, $this->object->renderSectionBody($section, $collection));
        self::assertSame('Comment="1"' . PHP_EOL, file_get_contents($this->file));
    }