Usuario:ManuelRomero/proyecto/proyectoIternova/borrador

De WikiEducator
Saltar a: navegación, buscar
 /**
     * @covers Monitorizacion_Controller_Servoces::get_value_of_performance_data
     * @group production
     * @runInSeparateProcess
     */
    public function testGet_value_of_performance_data() {
 
        $array = array(
            array( 'expected' => 0.013585, 'input' => "time=0.013585s;;;0.000000;10.000000", 'type' => 'float' ),
            array( 'expected' => null, 'input' => "time=;;;0.000000;10.000000", 'type' => 'null' ),
        );
        foreach ( $array as $index => $data ) {
//            echo PHP_EOL;
            $value_returned = Monitorizacion_Controller_Services::get_value_of_performance_data( $data[ 'input' ] );
//            echo ">>>" . $data['input'] . PHP_EOL;
//            echo ">>>" . $data['expected'] . PHP_EOL;
//            echo ">>>" . $value_returned . PHP_EOL;
            $this->assertEquals( $data[ 'expected' ], $value_returned, "ERROR: " . $data[ 'expected' ] . " != " . $value_returned, 0.001 );
            $this->assertInternalType( $data[ 'type' ], $value_returned );
        }
 
    }
 
    /**
     * @covers Monitorizacion_Controller::service_host_to_string
     * @group production
     * @runInSeparateProcess
     */
    public function testService_host_to_string() {
// Comparacion de fechas
        $array = array(
            Monitorizacion_Constants::SERVICIO_SSH => 'SSH',
            Monitorizacion_Constants::SERVICIO_HTTP => 'HTTP',
            Monitorizacion_Constants::SERVICIO_MYSQL => 'MYSQL',
            Monitorizacion_Constants::SERVICIO_DISCOS => 'DISK',
            Monitorizacion_Constants::SERVICIO_CPU => 'CPU',
            Monitorizacion_Constants::SERVICIO_PING => 'PING',
            -1 => null
        );
        foreach ( $array as $servicio => $value_expected ) {
            $this->assertEquals( $value_expected, Monitorizacion_Controller::service_host_to_string( $servicio ), "ERROR: $value_expected != " . Monitorizacion_Controller::service_host_to_string( $servicio ) );
        }
 
    }