Ver Mensaje Individual
  #1 (permalink)  
Antiguo 08/04/2010, 12:14
manoloOZ
 
Fecha de Ingreso: octubre-2008
Mensajes: 151
Antigüedad: 15 años, 6 meses
Puntos: 1
Doble herencia de clases

Hola tengo el siguiente problema, tengo una clase"IWT_ValidateIP" que hereda de otra clase "PHPUnit_Framework_TestCase". Esta funciona perfectamente el problema es cuando quiero hacer otra clase "IWT_ValidateLocalhostIPAddress" que herede de "IWT_ValidateIP". Ahi cuando abro la clase "IWT_ValidateLocalhostIPAddress" me tira el siguiente error "Fatal error: Class 'IWT_ValidateIP' not found in..".

Les dejo el codgio de las dos clases.

Código PHP:
<?php
include ('IWT_ValidateIP.php');
class 
IWT_ValidateLocalhostIPAddress extends IWT_ValidateIP
{
   public function 
testValidateLocalHostIP()
    {
        
$ip $this->validate->localhostIpAddress('192.15.178.10');
        
$this->assertFalse($ip->isValid"Not Localhost IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'IPADDRESS_NOT_LOCALHOST'"Not complete  IP [$ip->value] must be invalid");

        
$ip $this->validate->localhostIpAddress('127.0.0.1');
        
$this->assertTrue($ip->isValid"Localhost IP [$ip->value] must be valid");

        
$ip $this->validate->localhostIpAddress('::1');
        
$this->assertTrue($ip->isValid"Localhost IP [$ip->value] must be valid");
        
        
$ip $this->validate->localhostIpAddress('0:0:0:0:0:0:0:1');
        
$this->assertTrue($ip->isValid"Localhost IP [$ip->value] must be valid");
    }

}
?>
Código PHP:
<?php
class IWT_ValidateIP extends PHPUnit_Framework_TestCase
{
    protected 
$validate;

    protected function 
setUp()
    {
        
iwt_init(iwt_test_config());
        
$find iwt_finder();
        
$this->validate $find->any('IWT_Validate');
    }

    public function 
testValidateEmptyIP()
    {
        
$ip $this->validate->localhostIpAddress('');
        
$this->assertFalse($ip->isValid"Empty IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'INVALID_IPADDRESS'"Empty IP [$ipt->value] must be invalid");
    }

    public function 
testValidateInvalidCharactersIP()
    {
        
$ip $this->validate->localhostIpAddress('19a.168.152.134');
        
$this->assertFalse($ip->isValid"Invalid Character IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'INVALID_IPADDRESS'"Invalid Character IP [$ip->value] must be invalid");

        
$ip $this->validate->localhostIpAddress('192.1»8.152.134');
        
$this->assertFalse($ip->isValid"Invalid Character IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'INVALID_IPADDRESS'"Invalid Character IP [$ip->value] must be invalid");

        
$ip $this->validate->localhostIpAddress('192.138.15♫.134');
        
$this->assertFalse($ip->isValid"Invalid Character IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'INVALID_IPADDRESS'"Invalid Character IP [$ip->value] must be invalid");

        
$ip $this->validate->localhostIpAddress('192.128.152.13¾');
        
$this->assertFalse($ip->isValid"Invalid Character IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'INVALID_IPADDRESS'"Invalid Character IP [$ip->value] must be invalid");
    }

    public function 
testValidateTwoPointsIP()
    {
        
$ip $this->validate->localhostIpAddress('192.15..131.120');
        
$this->assertFalse($ip->isValid"Two Points IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'INVALID_IPADDRESS'"Two Points IP [$ip->value] must be invalid");
    }
    public function 
testValidateOutOfRangeIP()
    {
        
$ip $this->validate->localhostIpAddress('192.15.256.120');
        
$this->assertFalse($ip->isValid"Out of range IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'INVALID_IPADDRESS'"Out of range IP [$ip->value] must be invalid");

        
$ip $this->validate->localhostIpAddress('-1.255.255.300');
        
$this->assertFalse($ip->isValid"Out of range IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'INVALID_IPADDRESS'"Out of range IP [$ip->value] must be invalid");
    }

        public function 
testValidateIPNotComplete()
    {
        
$ip $this->validate->localhostIpAddress('192.15.178');
        
$this->assertFalse($ip->isValid"Not complete IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'INVALID_IPADDRESS'"Not complete  IP [$ip->value] must be invalid");

        
$ip $this->validate->localhostIpAddress('192.15.178.1.145');
        
$this->assertFalse($ip->isValid"Not complete IP [$ip->value] must be invalid");
        
$this->assertEquals($ip->errorCode'INVALID_IPADDRESS'"Not complete  IP [$ip->value] must be invalid");
    }
}

?>