<commit_before><?php
/**
 * XMPP Library
 *
 * Copyright (C) 2016, Some right reserved.
 *
 * @author Kacper "Kadet" Donat <<EMAIL>>
 *
 * Contact with author:
 * Xmpp: <EMAIL>
 * E-mail: <EMAIL>
 *
 * From Kadet with love.
 */

namespace Kadet\Xmpp\Tests;


use Kadet\Xmpp\Utils\DnsResolver;
use phpmock\phpunit\PHPMock;

class DnsResolverTest extends \PHPUnit_Framework_TestCase
{
    use PHPMock;

    public function testResolving()
    {
        $mock = $this->getFunctionMock(dirname(DnsResolver::class), 'dns_get_record');
        $mock->expects($this->exactly(2))->withConsecutive(['foo.tld', DNS_A], ['bar.tld', DNS_SRV])->willReturn([
            [
                'target' => '8.8.8.8',
                'port' => 1337
            ],
            [
                'target' => '8.8.4.4',
                'port' => 2137
            ],
        ], [
            [
                'target' => '10.0.0.1',
                'port' => 1984
            ],
            [
                'target' => 'xmpp.ru',
                'port' => 2033
            ],
        ]);

        $resolver = new DnsResolver([
            'foo.tld' => DNS_A,
            'bar.tld' => DNS_SRV
        ]);

        $this->assertEquals([
            ['8.8.8.8', 1337],
            ['8.8.4.4', 2137],
            ['10.0.0.1', 1984],
            ['xmpp.ru', 2033]
        ], iterator_to_array($resolver));
    }
}
<commit_msg>fix test for linux machines<commit_after><?php
/**
 * XMPP Library
 *
 * Copyright (C) 2016, Some right reserved.
 *
 * @author Kacper "Kadet" Donat <<EMAIL>>
 *
 * Contact with author:
 * Xmpp: <EMAIL>
 * E-mail: <EMAIL>
 *
 * From Kadet with love.
 */

namespace Kadet\Xmpp\Tests;


use Kadet\Xmpp\Utils\DnsResolver;
use phpmock\phpunit\PHPMock;

class DnsResolverTest extends \PHPUnit_Framework_TestCase
{
    use PHPMock;

    public function testResolving()
    {
        $mock = $this->getFunctionMock(substr(DnsResolver::class, 0, strrpos(DnsResolver::class, '\\')), 'dns_get_record');
        $mock->expects($this->exactly(2))->withConsecutive(['foo.tld', DNS_A], ['bar.tld', DNS_SRV])->willReturn([
            [
                'target' => '8.8.8.8',
                'port' => 1337
            ],
            [
                'target' => '8.8.4.4',
                'port' => 2137
            ],
        ], [
            [
                'target' => '10.0.0.1',
                'port' => 1984
            ],
            [
                'target' => 'xmpp.ru',
                'port' => 2033
            ],
        ]);

        $resolver = new DnsResolver([
            'foo.tld' => DNS_A,
            'bar.tld' => DNS_SRV
        ]);

        $this->assertEquals([
            ['8.8.8.8', 1337],
            ['8.8.4.4', 2137],
            ['10.0.0.1', 1984],
            ['xmpp.ru', 2033]
        ], iterator_to_array($resolver));
    }
}

{'fraction_non_alphanumeric': 0.17222027358821465, 'fraction_numerical': 0.0445457734128376, 'mean_word_length': 1.5238938053097346, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 12, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4859707', 'n_tokens_mistral': 1077, 'n_tokens_neox': 978, 'n_words': 166}