404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.118.160.203: ~ $
<?php

namespace React\Tests\EventLoop;

use React\EventLoop\SignalsHandler;

final class SignalsHandlerTest extends TestCase
{
    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.24 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
SignalsHandlerTest.php File 1.33 KB 0644
StreamSelectLoopTest.php File 3.96 KB 0644
TestCase.php File 1.11 KB 0644
bootstrap.php File 317 B 0644