!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_tdfonline/proyectos/toba_referencia/test/rest/personas/   drwxr-xr-x
Free 14.55 GB of 61.93 GB (23.49%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


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

require_once 'lib/rest/toba/rest_test_case.php';

class 
recurso_personasTest extends \rest\toba\rest_test_case {


    protected function 
setUp()
    {
        
parent::setUp();
        
$app $this->setupRest();

        
$user = new \rest\seguridad\rest_usuario();
        
$user->set_usuario('user');
        
$this->mock_autenticador($user$app);
    }

    public function 
testGetList()
    {
        
$response $this->ejecutar('GET''/personas');

        
$personas $response->get_data();

        
$this->assertEquals($response->get_status(), 200);
        
$this->assertTrue(count($personas) > 0);
        
$this->assertArrayHasKey('id'$personas[0]);
        
$this->assertArrayHasKey('nombre'$personas[0]);
        
$this->assertArrayHasKey('fecha_nac'$personas[0]);

        return 
$personas[0];
    }

    
/**
     * @depends testGetList
     */
    
public function testGetListFiltro($persona)
    {
        
$nombre $persona['nombre'];

        
$get = array('nombre' => "es_igual_a;$nombre");
        
$response $this->ejecutar('GET''/personas'$get);

        
$persona_res $response->get_data();

        
$this->assertEquals($response->get_status(), 200);

        foreach (
$persona_res as $p) {
            
$this->assertEquals($nombre$p['nombre']);
        }

        
$this->assertEquals(1count($persona_res), 200);
    }

    public function 
testPost()
    {
        
$post = array(
            
'nombre' => 'Julia',
            
'fecha_nac' => '1990-03-03'
            
);

        
$response $this->ejecutar('POST''/personas', array(), $post);
        
$res_post $response->get_data();

        
$this->assertEquals($response->get_status(), 201);
        
$this->assertArrayHasKey('id'$res_post);

        
$response $this->ejecutar('GET''/personas/'.$res_post['id']);
        
$res_get $response->get_data();

        
$this->assertEquals($response->get_status(), 200);

        
$this->assertEquals($res_post['id'], $res_get['id']);
        
$this->assertEquals($post['nombre'], $res_get['nombre']);
        
$this->assertEquals($post['fecha_nac'], $res_get['fecha_nac']);
        return 
$res_post['id'];
    }

    
/**
     * Traigo un id valido
     * @depends testPost
     **/
    
public function testPUT($id_posteado)
    {
        
//str random
        
$nombre substr"abcdefghijklmnopqrstuvwxyz"mt_rand(025) , 1) .substrmd5time() ), 1);

        
$post = array('nombre' => $nombre);
        
$response $this->ejecutar('PUT''/personas/'.$id_posteado, array(), $post);
        
$res_put $response->get_data();

        
$this->assertEquals($response->get_status(), 204); //ok, no content
        
$this->assertEmpty($res_put);

        
$response $this->ejecutar('GET''/personas/'.$id_posteado);
        
$res_get $response->get_data();

        
$this->assertEquals($response->get_status(), 200);
        
$this->assertEquals($id_posteado$res_get['id']);
        
$this->assertEquals($nombre$res_get['nombre']);
    }

    
/**
     * @depends testPost
     */
    
public function  testPUTError($id_valido)
    {
        
$post = array('campo_erroneo' => 'a');
        
$response $this->ejecutar('PUT''/personas/' $id_valido, array(), $post);
        
$res_put $response->get_data();

        
$this->assertEquals($response->get_status(), 400); //ok, no content
        
$this->assertNotEmpty($res_put);
    }


    
/**
     * @depends testPost
     */
    
public function  testDelete($id_valido)
    {
        
$response $this->ejecutar('DELETE''/personas/' $id_valido);
        
$res_put $response->get_data();

        
$this->assertEquals($response->get_status(), 204); //ok, no content
        
$this->assertEmpty($res_put);
    }

    public function 
testGet404()
    {
        
$id 'no-existe';

        
$response $this->ejecutar('GET''/personas/'.$id);

        
$persona_res $response->get_data();

        
$this->assertEquals($response->get_status(), 404);
    }




}

:: 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.6013 ]--