Linux unitednationsplay.com 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
nginx/1.20.1
Server IP : 188.130.139.92 & Your IP : 18.188.73.229
Domains :
Cant Read [ /etc/named.conf ]
User : web
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
home /
www /
unp /
vendor /
react /
dns /
tests /
Query /
Delete
Unzip
Name
Size
Permission
Date
Action
CachedExecutorTest.php
3.39
KB
-rw-r--r--
2018-11-11 09:00
ExecutorTest.php
9.73
KB
-rw-r--r--
2018-11-11 09:00
HostsFileExecutorTest.php
5.06
KB
-rw-r--r--
2018-11-11 09:00
RecordBagTest.php
2.66
KB
-rw-r--r--
2018-11-11 09:00
RecordCacheTest.php
6.88
KB
-rw-r--r--
2018-11-11 09:00
RetryExecutorTest.php
11.18
KB
-rw-r--r--
2018-11-11 09:00
TimeoutExecutorTest.php
3.69
KB
-rw-r--r--
2018-11-11 09:00
UdpTransportExecutorTest.php
7.05
KB
-rw-r--r--
2018-11-11 09:00
Save
Rename
<?php namespace React\Tests\Dns\Query; use React\Dns\Query\TimeoutExecutor; use React\Dns\Query\Query; use React\Dns\Model\Message; use React\Promise\Deferred; use React\Dns\Query\CancellationException; use React\Tests\Dns\TestCase; use React\EventLoop\Factory; use React\Promise; class TimeoutExecutorTest extends TestCase { public function setUp() { $this->loop = Factory::create(); $this->wrapped = $this->getMockBuilder('React\Dns\Query\ExecutorInterface')->getMock(); $this->executor = new TimeoutExecutor($this->wrapped, 5.0, $this->loop); } public function testCancellingPromiseWillCancelWrapped() { $cancelled = 0; $this->wrapped ->expects($this->once()) ->method('query') ->will($this->returnCallback(function ($domain, $query) use (&$cancelled) { $deferred = new Deferred(function ($resolve, $reject) use (&$cancelled) { ++$cancelled; $reject(new CancellationException('Cancelled')); }); return $deferred->promise(); })); $query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN, 1345656451); $promise = $this->executor->query('8.8.8.8:53', $query); $this->assertEquals(0, $cancelled); $promise->cancel(); $this->assertEquals(1, $cancelled); $promise->then($this->expectCallableNever(), $this->expectCallableOnce()); } public function testResolvesPromiseWhenWrappedResolves() { $this->wrapped ->expects($this->once()) ->method('query') ->willReturn(Promise\resolve('0.0.0.0')); $query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN, 1345656451); $promise = $this->executor->query('8.8.8.8:53', $query); $promise->then($this->expectCallableOnce(), $this->expectCallableNever()); } public function testRejectsPromiseWhenWrappedRejects() { $this->wrapped ->expects($this->once()) ->method('query') ->willReturn(Promise\reject(new \RuntimeException())); $query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN, 1345656451); $promise = $this->executor->query('8.8.8.8:53', $query); $promise->then($this->expectCallableNever(), $this->expectCallableOnceWith(new \RuntimeException())); } public function testWrappedWillBeCancelledOnTimeout() { $this->executor = new TimeoutExecutor($this->wrapped, 0, $this->loop); $cancelled = 0; $this->wrapped ->expects($this->once()) ->method('query') ->will($this->returnCallback(function ($domain, $query) use (&$cancelled) { $deferred = new Deferred(function ($resolve, $reject) use (&$cancelled) { ++$cancelled; $reject(new CancellationException('Cancelled')); }); return $deferred->promise(); })); $callback = $this->expectCallableNever(); $errorback = $this->createCallableMock(); $errorback ->expects($this->once()) ->method('__invoke') ->with($this->logicalAnd( $this->isInstanceOf('React\Dns\Query\TimeoutException'), $this->attribute($this->equalTo('DNS query for igor.io timed out'), 'message') )); $query = new Query('igor.io', Message::TYPE_A, Message::CLASS_IN, 1345656451); $this->executor->query('8.8.8.8:53', $query)->then($callback, $errorback); $this->assertEquals(0, $cancelled); $this->loop->run(); $this->assertEquals(1, $cancelled); } }