PEAR2_Net_RouterOS-1.0.0b3PEAR2_Net_RouterOS-1.0.0b3/tests/ClientPersistentFeaturesTest.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
<?php
namespace PEAR2\Net\RouterOS;

require_once 'ClientFeaturesTest.php';

class ClientPersistentFeaturesTest extends ClientFeaturesTest
{
    
    protected function setUp()
    {
        $this->object = new Client(\HOSTNAME, USERNAME, PASSWORD, PORT, true);
    }
    
    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', 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