404

[ Avaa Bypassed ]




Upload:

Command:

botdev@3.136.18.192: ~ $
<?php

namespace React\Tests\EventLoop;

use React\EventLoop\SignalsHandler;

final class SignalsHandlerTest extends TestCase
{
    /**
     * @requires extension pcntl
     */
    public function testEmittedEventsAndCallHandling()
    {
        $callCount = 0;
        $func = function () use (&$callCount) {
            $callCount++;
        };
        $signals = new SignalsHandler();

        $this->assertSame(0, $callCount);

        $signals->add(SIGUSR1, $func);
        $this->assertSame(0, $callCount);

        $signals->add(SIGUSR1, $func);
        $this->assertSame(0, $callCount);

        $signals->add(SIGUSR1, $func);
        $this->assertSame(0, $callCount);

        $signals->call(SIGUSR1);
        $this->assertSame(1, $callCount);

        $signals->add(SIGUSR2, $func);
        $this->assertSame(1, $callCount);

        $signals->add(SIGUSR2, $func);
        $this->assertSame(1, $callCount);

        $signals->call(SIGUSR2);
        $this->assertSame(2, $callCount);

        $signals->remove(SIGUSR2, $func);
        $this->assertSame(2, $callCount);

        $signals->remove(SIGUSR2, $func);
        $this->assertSame(2, $callCount);

        $signals->call(SIGUSR2);
        $this->assertSame(2, $callCount);

        $signals->remove(SIGUSR1, $func);
        $this->assertSame(2, $callCount);

        $signals->call(SIGUSR1);
        $this->assertSame(2, $callCount);
    }
}

Filemanager

Name Type Size Permission Actions
Timer Folder 0755
AbstractLoopTest.php File 17.43 KB 0644
CallableStub.php File 107 B 0644
ExtEvLoopTest.php File 355 B 0644
ExtEventLoopTest.php File 2.33 KB 0644
ExtLibevLoopTest.php File 454 B 0644
ExtLibeventLoopTest.php File 1.38 KB 0644
ExtUvLoopTest.php File 346 B 0644
SignalsHandlerTest.php File 1.38 KB 0644
StreamSelectLoopTest.php File 3.75 KB 0644
TestCase.php File 1.11 KB 0644