aboutsummaryrefslogtreecommitdiffhomepage
path: root/assets/php/vendor/react/dns/tests/Model/MessageTest.php
blob: 53d6b28f9a8d4d5b8de3cb14805511ac5a498359 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

namespace React\Tests\Dns\Model;

use PHPUnit\Framework\TestCase;
use React\Dns\Query\Query;
use React\Dns\Model\Message;

class MessageTest extends TestCase
{
    public function testCreateRequestDesiresRecusion()
    {
        $query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN, 1345656451);
        $request = Message::createRequestForQuery($query);

        $this->assertTrue($request->header->isQuery());
        $this->assertSame(1, $request->header->get('rd'));
    }

    public function testCreateResponseWithNoAnswers()
    {
        $query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN, 1345656451);
        $answers = array();
        $request = Message::createResponseWithAnswersForQuery($query, $answers);

        $this->assertFalse($request->header->isQuery());
        $this->assertTrue($request->header->isResponse());
        $this->assertEquals(0, $request->header->get('anCount'));
    }
}