<commit_before><?php
namespace Disc\Zabbix\Tests;

use Disc\Zabbix\Sender;
use PHPUnit_Framework_MockObject_MockObject;
use PHPUnit_Framework_TestCase;
use ReflectionMethod;

/**
 * Class SenderTest
 * @package Disc\Zabbix\Tests
 *
 * @covers Disc\Zabbix\Sender
 * @coversDefaultClass Disc\Zabbix\Sender
 */
class SenderTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var PHPUnit_Framework_MockObject_MockObject|\Disc\Zabbix\Sender
     */
    protected $sender;

    public function setUp()
    {
        $this->sender = new Sender('localhost', 10051);

        $this->sender = $this->getMockBuilder(Sender::class)
            ->disableOriginalConstructor()
            ->setMethods(['send','getResponse'])
            ->getMock();

        $this->sender
            ->expects($this->any())
            ->method('send')
            ->willReturn($this->sender);

        $this->sender
            ->expects($this->any())
            ->method('getResponse')
            ->willReturn([
                'response' => 'success',
                'info' => 'processed: 1; failed: 1; total: 2; seconds spent: 0.000021',
            ]);
    }

    /**
     * Test for getData
     *
     * @covers ::getData
     */
    public function testAddData()
    {
        $method = new ReflectionMethod(Sender::class, 'getData');
        $method->setAccessible(true);

        $this->assertCount(0, $method->invoke($this->sender));
        $this->sender->addData('Host', 'test.key', 'some value');
        $this->sender->addData('Host', 'another.key', 123);
        $this->sender->addData('Host', 'one.more.key', 0.001, time());
        $this->assertCount(3, $method->invoke($this->sender));
    }
<commit_msg>Fixed test php 5.3, 5.4<commit_after><?php
namespace Disc\Zabbix\Tests;

use Disc\Zabbix\Sender;
use PHPUnit_Framework_MockObject_MockObject;
use PHPUnit_Framework_TestCase;
use ReflectionMethod;

/**
 * Class SenderTest
 * @package Disc\Zabbix\Tests
 *
 * @covers Disc\Zabbix\Sender
 * @coversDefaultClass Disc\Zabbix\Sender
 */
class SenderTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var PHPUnit_Framework_MockObject_MockObject|\Disc\Zabbix\Sender
     */
    protected $sender;

    public function setUp()
    {
        $this->sender = new Sender('localhost', 10051);

        $this->sender = $this->getMockBuilder('Sender')
            ->disableOriginalConstructor()
            ->setMethods(['send','getResponse'])
            ->getMock();

        $this->sender
            ->expects($this->any())
            ->method('send')
            ->willReturn($this->sender);

        $this->sender
            ->expects($this->any())
            ->method('getResponse')
            ->willReturn([
                'response' => 'success',
                'info' => 'processed: 1; failed: 1; total: 2; seconds spent: 0.000021',
            ]);
    }

    /**
     * Test for getData
     *
     * @covers ::getData
     */
    public function testAddData()
    {
        $method = new ReflectionMethod('Sender', 'getData');
        $method->setAccessible(true);

        $this->assertCount(0, $method->invoke($this->sender));
        $this->sender->addData('Host', 'test.key', 'some value');
        $this->sender->addData('Host', 'another.key', 123);
        $this->sender->addData('Host', 'one.more.key', 0.001, time());
        $this->assertCount(3, $method->invoke($this->sender));
    }

{'fraction_non_alphanumeric': 0.16402582159624413, 'fraction_numerical': 0.015258215962441314, 'mean_word_length': 2.4679552390640893, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '1030988', 'n_tokens_mistral': 1067, 'n_tokens_neox': 1013, 'n_words': 178}