!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.22 (Debian). PHP/5.6.36 

uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 

uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) 

Safe-mode: OFF (not secure)

/home/h33678/data/www/it-man.ztu.edu.ua/src/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/   drwxr-xr-x
Free 116.5 GB of 200.55 GB (58.09%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     BandwidthMonitorPluginTest.php (4.1 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

class Swift_Plugins_BandwidthMonitorPluginTest extends \PHPUnit_Framework_TestCase
{
    private 
$_monitor;

    private 
$_bytes 0;

    public function 
setUp()
    {
        
$this->_monitor = new Swift_Plugins_BandwidthMonitorPlugin();
    }

    public function 
testBytesOutIncreasesWhenCommandsSent()
    {
        
$evt $this->_createCommandEvent("RCPT TO:<foo@bar.com>\r\n");

        
$this->assertEquals(0$this->_monitor->getBytesOut());
        
$this->_monitor->commandSent($evt);
        
$this->assertEquals(23$this->_monitor->getBytesOut());
        
$this->_monitor->commandSent($evt);
        
$this->assertEquals(46$this->_monitor->getBytesOut());
    }

    public function 
testBytesInIncreasesWhenResponsesReceived()
    {
        
$evt $this->_createResponseEvent("250 Ok\r\n");

        
$this->assertEquals(0$this->_monitor->getBytesIn());
        
$this->_monitor->responseReceived($evt);
        
$this->assertEquals(8$this->_monitor->getBytesIn());
        
$this->_monitor->responseReceived($evt);
        
$this->assertEquals(16$this->_monitor->getBytesIn());
    }

    public function 
testCountersCanBeReset()
    {
        
$evt $this->_createResponseEvent("250 Ok\r\n");

        
$this->assertEquals(0$this->_monitor->getBytesIn());
        
$this->_monitor->responseReceived($evt);
        
$this->assertEquals(8$this->_monitor->getBytesIn());
        
$this->_monitor->responseReceived($evt);
        
$this->assertEquals(16$this->_monitor->getBytesIn());

        
$evt $this->_createCommandEvent("RCPT TO:<foo@bar.com>\r\n");

        
$this->assertEquals(0$this->_monitor->getBytesOut());
        
$this->_monitor->commandSent($evt);
        
$this->assertEquals(23$this->_monitor->getBytesOut());
        
$this->_monitor->commandSent($evt);
        
$this->assertEquals(46$this->_monitor->getBytesOut());

        
$this->_monitor->reset();

        
$this->assertEquals(0$this->_monitor->getBytesOut());
        
$this->assertEquals(0$this->_monitor->getBytesIn());
    }

    public function 
testBytesOutIncreasesAccordingToMessageLength()
    {
        
$message $this->_createMessageWithByteCount(6);
        
$evt $this->_createSendEvent($message);

        
$this->assertEquals(0$this->_monitor->getBytesOut());
        
$this->_monitor->sendPerformed($evt);
        
$this->assertEquals(6$this->_monitor->getBytesOut());
        
$this->_monitor->sendPerformed($evt);
        
$this->assertEquals(12$this->_monitor->getBytesOut());
    }

    
// -- Creation Methods

    
private function _createSendEvent($message)
    {
        
$evt $this->getMockBuilder('Swift_Events_SendEvent')
                    ->
disableOriginalConstructor()
                    ->
getMock();
        
$evt->expects($this->any())
            ->
method('getMessage')
            ->
will($this->returnValue($message));

        return 
$evt;
    }

    private function 
_createCommandEvent($command)
    {
        
$evt $this->getMockBuilder('Swift_Events_CommandEvent')
                    ->
disableOriginalConstructor()
                    ->
getMock();
        
$evt->expects($this->any())
            ->
method('getCommand')
            ->
will($this->returnValue($command));

        return 
$evt;
    }

    private function 
_createResponseEvent($response)
    {
        
$evt $this->getMockBuilder('Swift_Events_ResponseEvent')
                    ->
disableOriginalConstructor()
                    ->
getMock();
        
$evt->expects($this->any())
            ->
method('getResponse')
            ->
will($this->returnValue($response));

        return 
$evt;
    }

    private function 
_createMessageWithByteCount($bytes)
    {
        
$this->_bytes $bytes;
        
$msg $this->getMock('Swift_Mime_Message');
        
$msg->expects($this->any())
            ->
method('toByteStream')
            ->
will($this->returnCallback(array($this'_write')));
      
/*  $this->_checking(Expectations::create()
            -> ignoring($msg)->toByteStream(any()) -> calls(array($this, '_write'))
        ); */

        
return $msg;
    }

    public function 
_write($is)
    {
        for (
$i 0$i $this->_bytes; ++$i) {
            
$is->write('x');
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by PinoyWH1Z | C99Shell Github | Generation time: 0.0151 ]--