PEAR2_Net_RouterOSPEAR2_Net_RouterOS-1.0.0b4/tests/Client/Safe/Persistent.php

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

namespace PEAR2\Net\RouterOS\Client\Test\Safe;

use PEAR2\Net\RouterOS\Client;
use PEAR2\Net\RouterOS\Client\Test;
use PEAR2\Net\RouterOS\Client\Test\SafeTest;
use PEAR2\Net\RouterOS\Request;

require_once __DIR__ . '/../SafeTest.php';

abstract class Persistent extends SafeTest
{
    
    protected function tearDown()
    {
        $this->object->close();
        unset($this->object);
    }
    
    public function testCancellingSeparation()
    {
        $client = new Client(\HOSTNAME, USERNAME, PASSWORD, PORT, true);
        $pingRequest = new Request('/ping', null, 'ping');
        $pingRequest->setArgument('address', Test\HOSTNAME);
        $this->object->sendAsync($pingRequest);
        $client->sendAsync($pingRequest);
        $client->loop(2);
        $this->object->loop(2);
        $this->assertGreaterThan(
            0,
            count($client->extractNewResponses('ping'))
        );
        $this->assertGreaterThan(
            0,
            count($this->object->extractNewResponses('ping'))
        );
        unset($client);
        $this->object->loop(2);
        $this->assertGreaterThan(
            0,
            count($this->object->extractNewResponses('ping'))
        );
    }
}
EOF