I have the following class:
class Validator {
public function __construct($file){
$errors = $this->errors($file_array[CSV]['errors']);
}
public function errors_func($errors){
if($errors != 0){
throw new Exception('Error Uploading');
}
}
}
I'm attempting to target the errors_func()
function directly through my test script without the need to first invoke the constructor. The PHPT test script can be seen below:
--TEST--
check_mime() function - A basic test to see if check mime works. :)
--FILE--
<?php
require_once('my/path');
$valid = new Validation;
$re = $valid->errors_func('1);
var_dump($re);
?>
--EXPECT--
bool(true)
As you would expect though the test script fails becuase a parameter is expected when the object of the class is created. Is there a way to create an object of the Validation class without needing to pass an argument to the class __constructer?