!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/apex_led/php/vendor/react/promise/tests/PromiseTest/   drwxrwxr-x
Free 15.69 GB of 61.93 GB (25.33%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     NotifyTestTrait.php (8.79 KB)      -rwxrwxr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace React\Promise\PromiseTest;

trait 
NotifyTestTrait
{
    
/**
     * @return \React\Promise\PromiseAdapter\PromiseAdapterInterface
     */
    
abstract public function getPromiseTestAdapter(callable $canceller null);

    
/** @test */
    
public function notifyShouldProgress()
    {
        
$adapter $this->getPromiseTestAdapter();

        
$sentinel = new \stdClass();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->once())
            ->
method('__invoke')
            ->
with($sentinel);

        
$adapter->promise()
            ->
then($this->expectCallableNever(), $this->expectCallableNever(), $mock);

        
$adapter->notify($sentinel);
    }

    
/** @test */
    
public function notifyShouldPropagateProgressToDownstreamPromises()
    {
        
$adapter $this->getPromiseTestAdapter();

        
$sentinel = new \stdClass();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->once())
            ->
method('__invoke')
            ->
will($this->returnArgument(0));

        
$mock2 $this->createCallableMock();
        
$mock2
            
->expects($this->once())
            ->
method('__invoke')
            ->
with($sentinel);

        
$adapter->promise()
            ->
then(
                
$this->expectCallableNever(),
                
$this->expectCallableNever(),
                
$mock
            
)
            ->
then(
                
$this->expectCallableNever(),
                
$this->expectCallableNever(),
                
$mock2
            
);

        
$adapter->notify($sentinel);
    }

    
/** @test */
    
public function notifyShouldPropagateTransformedProgressToDownstreamPromises()
    {
        
$adapter $this->getPromiseTestAdapter();

        
$sentinel = new \stdClass();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->once())
            ->
method('__invoke')
            ->
will($this->returnValue($sentinel));

        
$mock2 $this->createCallableMock();
        
$mock2
            
->expects($this->once())
            ->
method('__invoke')
            ->
with($sentinel);

        
$adapter->promise()
            ->
then(
                
$this->expectCallableNever(),
                
$this->expectCallableNever(),
                
$mock
            
)
            ->
then(
                
$this->expectCallableNever(),
                
$this->expectCallableNever(),
                
$mock2
            
);

        
$adapter->notify(1);
    }

    
/** @test */
    
public function notifyShouldPropagateCaughtExceptionValueAsProgress()
    {
        
$adapter $this->getPromiseTestAdapter();

        
$exception = new \Exception();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->once())
            ->
method('__invoke')
            ->
will($this->throwException($exception));

        
$mock2 $this->createCallableMock();
        
$mock2
            
->expects($this->once())
            ->
method('__invoke')
            ->
with($this->identicalTo($exception));

        
$adapter->promise()
            ->
then(
                
$this->expectCallableNever(),
                
$this->expectCallableNever(),
                
$mock
            
)
            ->
then(
                
$this->expectCallableNever(),
                
$this->expectCallableNever(),
                
$mock2
            
);

        
$adapter->notify(1);
    }

    
/** @test */
    
public function notifyShouldForwardProgressEventsWhenIntermediaryCallbackTiedToAResolvedPromiseReturnsAPromise()
    {
        
$adapter $this->getPromiseTestAdapter();
        
$adapter2 $this->getPromiseTestAdapter();

        
$promise2 $adapter2->promise();

        
$sentinel = new \stdClass();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->once())
            ->
method('__invoke')
            ->
with($sentinel);

        
// resolve BEFORE attaching progress handler
        
$adapter->resolve();

        
$adapter->promise()
            ->
then(function () use ($promise2) {
                return 
$promise2;
            })
            ->
then(
                
$this->expectCallableNever(),
                
$this->expectCallableNever(),
                
$mock
            
);

        
$adapter2->notify($sentinel);
    }

    
/** @test */
    
public function notifyShouldForwardProgressEventsWhenIntermediaryCallbackTiedToAnUnresolvedPromiseReturnsAPromise()
    {
        
$adapter $this->getPromiseTestAdapter();
        
$adapter2 $this->getPromiseTestAdapter();

        
$promise2 $adapter2->promise();

        
$sentinel = new \stdClass();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->once())
            ->
method('__invoke')
            ->
with($sentinel);

        
$adapter->promise()
            ->
then(function () use ($promise2) {
                return 
$promise2;
            })
            ->
then(
                
$this->expectCallableNever(),
                
$this->expectCallableNever(),
                
$mock
            
);

        
// resolve AFTER attaching progress handler
        
$adapter->resolve();
        
$adapter2->notify($sentinel);
    }

    
/** @test */
    
public function notifyShouldForwardProgressWhenResolvedWithAnotherPromise()
    {
        
$adapter $this->getPromiseTestAdapter();
        
$adapter2 $this->getPromiseTestAdapter();

        
$sentinel = new \stdClass();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->once())
            ->
method('__invoke')
            ->
will($this->returnValue($sentinel));

        
$mock2 $this->createCallableMock();
        
$mock2
            
->expects($this->once())
            ->
method('__invoke')
            ->
with($sentinel);

        
$adapter->promise()
            ->
then(
                
$this->expectCallableNever(),
                
$this->expectCallableNever(),
                
$mock
            
)
            ->
then(
                
$this->expectCallableNever(),
                
$this->expectCallableNever(),
                
$mock2
            
);

        
$adapter->resolve($adapter2->promise());
        
$adapter2->notify($sentinel);
    }

    
/** @test */
    
public function notifyShouldAllowResolveAfterProgress()
    {
        
$adapter $this->getPromiseTestAdapter();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->at(0))
            ->
method('__invoke')
            ->
with($this->identicalTo(1));
        
$mock
            
->expects($this->at(1))
            ->
method('__invoke')
            ->
with($this->identicalTo(2));

        
$adapter->promise()
            ->
then(
                
$mock,
                
$this->expectCallableNever(),
                
$mock
            
);

        
$adapter->notify(1);
        
$adapter->resolve(2);
    }

    
/** @test */
    
public function notifyShouldAllowRejectAfterProgress()
    {
        
$adapter $this->getPromiseTestAdapter();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->at(0))
            ->
method('__invoke')
            ->
with($this->identicalTo(1));
        
$mock
            
->expects($this->at(1))
            ->
method('__invoke')
            ->
with($this->identicalTo(2));

        
$adapter->promise()
            ->
then(
                
$this->expectCallableNever(),
                
$mock,
                
$mock
            
);

        
$adapter->notify(1);
        
$adapter->reject(2);
    }

    
/** @test */
    
public function notifyShouldReturnSilentlyOnProgressWhenAlreadyRejected()
    {
        
$adapter $this->getPromiseTestAdapter();

        
$adapter->reject(1);

        
$this->assertNull($adapter->notify());
    }

    
/** @test */
    
public function notifyShouldInvokeProgressHandler()
    {
        
$adapter $this->getPromiseTestAdapter();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->once())
            ->
method('__invoke')
            ->
with($this->identicalTo(1));

        
$adapter->promise()->progress($mock);
        
$adapter->notify(1);
    }

    
/** @test */
    
public function notifyShouldInvokeProgressHandlerFromDone()
    {
        
$adapter $this->getPromiseTestAdapter();

        
$mock $this->createCallableMock();
        
$mock
            
->expects($this->once())
            ->
method('__invoke')
            ->
with($this->identicalTo(1));

        
$this->assertNull($adapter->promise()->done(nullnull$mock));
        
$adapter->notify(1);
    }

    
/** @test */
    
public function notifyShouldThrowExceptionThrownProgressHandlerFromDone()
    {
        
$adapter $this->getPromiseTestAdapter();

        
$this->setExpectedException('\Exception''UnhandledRejectionException');

        
$this->assertNull($adapter->promise()->done(nullnull, function () {
            throw new \
Exception('UnhandledRejectionException');
        }));
        
$adapter->notify(1);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.2917 ]--