<commit_before><?php

/*
 * Copyright (c) 2016 Refinery29, Inc.
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */
namespace Refinery29\Sitemap\Test\Unit\Writer;

use Refinery29\Test\Util\Faker\GeneratorTrait;
use SplObjectStorage;

abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase
{
    use GeneratorTrait;

    /**
     * @param \PHPUnit_Framework_MockObject_MockObject $xmlWriter
     * @param string                                   $version
     * @param string                                   $charset
     */
    protected function expectToStartDocument(\PHPUnit_Framework_MockObject_MockObject $xmlWriter, $version = '1.0', $charset = 'UTF-8')
    {
        $xmlWriter
            ->expects($this->next($xmlWriter))
            ->method('startDocument')
            ->with(
                $this->identicalTo($version),
                $this->identicalTo($charset)
            )
        ;
    }

    /**
     * @param \PHPUnit_Framework_MockObject_MockObject $xmlWriter
     * @param string                                   $name
     */
    protected function expectToStartElement(\PHPUnit_Framework_MockObject_MockObject $xmlWriter, $name)
    {
        $xmlWriter
            ->expects($this->next($xmlWriter))
            ->method('startElement')
            ->with($this->identicalTo($name))
        ;
    }

    /**
     * @param \PHPUnit_Framework_MockObject_MockObject $xmlWriter
     * @param string                                   $name
     * @param mixed                                    $value
     */
    protected function expectToWriteAttribute(\PHPUnit_Framework_MockObject_MockObject $xmlWriter, $name, $value)
    {
        $xmlWriter
            ->expects($this->next($xmlWriter))
            ->method('writeAttribute')
            ->with(
                $this->identicalTo($name),
                $this->identicalTo($value)
            )
        ;
    }

    /**
     * @param \PHPUnit_Framework_MockObject_MockObject $xmlWriter
     */
    protected function expectToEndElement(\PHPUnit_Framework_MockObject_MockObject $xmlWriter)
    {
        $xmlWriter
            ->expects($this->next($xmlWriter))
            ->method('endElement')
        ;
    }

    /**
     * @param \PHPUnit_Framework_MockObject_MockObject $xmlWriter
     */
    protected function expectToEndDocument(\PHPUnit_Framework_MockObject_MockObject $xmlWriter)
    {
        $xmlWriter
            ->expects($this->next($xmlWriter))
            ->method('endDocument')
        ;
    }

    /**
     * @param \PHPUnit_Framework_MockObject_MockObject $xmlWriter
     * @param string                                   $name
     * @param mixed                                    $text
     * @param array                                    $attributes
     */
    protected function expectToWriteElement(\PHPUnit_Framework_MockObject_MockObject $xmlWriter, $name, $text = null, array $attributes = [])
    {
        $this->expectToStartElement($xmlWriter, $name);

        foreach ($attributes as $name => $value) {
            $this->expectToWriteAttribute($xmlWriter, $name, $value);
        }

        if ($text !== null) {<commit_msg>Fix: Remove useless docblocks<commit_after><?php

/*
 * Copyright (c) 2016 Refinery29, Inc.
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */
namespace Refinery29\Sitemap\Test\Unit\Writer;

use Refinery29\Test\Util\Faker\GeneratorTrait;
use SplObjectStorage;

abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase
{
    use GeneratorTrait;

    /**
     * @param \PHPUnit_Framework_MockObject_MockObject $xmlWriter
     * @param string                                   $version
     * @param string                                   $charset
     */
    protected function expectToStartDocument(\PHPUnit_Framework_MockObject_MockObject $xmlWriter, $version = '1.0', $charset = 'UTF-8')
    {
        $xmlWriter
            ->expects($this->next($xmlWriter))
            ->method('startDocument')
            ->with(
                $this->identicalTo($version),
                $this->identicalTo($charset)
            )
        ;
    }

    /**
     * @param \PHPUnit_Framework_MockObject_MockObject $xmlWriter
     * @param string                                   $name
     */
    protected function expectToStartElement(\PHPUnit_Framework_MockObject_MockObject $xmlWriter, $name)
    {
        $xmlWriter
            ->expects($this->next($xmlWriter))
            ->method('startElement')
            ->with($this->identicalTo($name))
        ;
    }

    /**
     * @param \PHPUnit_Framework_MockObject_MockObject $xmlWriter
     * @param string                                   $name
     * @param mixed                                    $value
     */
    protected function expectToWriteAttribute(\PHPUnit_Framework_MockObject_MockObject $xmlWriter, $name, $value)
    {
        $xmlWriter
            ->expects($this->next($xmlWriter))
            ->method('writeAttribute')
            ->with(
                $this->identicalTo($name),
                $this->identicalTo($value)
            )
        ;
    }

    protected function expectToEndElement(\PHPUnit_Framework_MockObject_MockObject $xmlWriter)
    {
        $xmlWriter
            ->expects($this->next($xmlWriter))
            ->method('endElement')
        ;
    }

    protected function expectToEndDocument(\PHPUnit_Framework_MockObject_MockObject $xmlWriter)
    {
        $xmlWriter
            ->expects($this->next($xmlWriter))
            ->method('endDocument')
        ;
    }

    /**
     * @param \PHPUnit_Framework_MockObject_MockObject $xmlWriter
     * @param string                                   $name
     * @param mixed                                    $text
     * @param array                                    $attributes
     */
    protected function expectToWriteElement(\PHPUnit_Framework_MockObject_MockObject $xmlWriter, $name, $text = null, array $attributes = [])
    {
        $this->expectToStartElement($xmlWriter, $name);

        foreach ($attributes as $name => $value) {
            $this->expectToWriteAttribute($xmlWriter, $name, $value);
        }

        if ($text !== null) {
{'fraction_non_alphanumeric': 0.10570258349086327, 'fraction_numerical': 0.004095778197857593, 'mean_word_length': 1.8624887285843101, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 46}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3383557', 'n_tokens_mistral': 1690, 'n_tokens_neox': 1629, 'n_words': 299}