Everything is fine with you, but you need to put it constat the class level not inside the function, for example:
class {
const TEST = "abc";
public $test2;
function tester{
}
}
More here
Also, you were not $in the public variabletest
source
share