These are chat archives for HylianShield/validator

25th
Oct 2015
Jan-Marten de Boer
@johmanx10
Oct 25 2015 18:18
That should be resolved now
Jan-Marten de Boer
@johmanx10
Oct 25 2015 20:43
Most hacky unit test I have ever written:
    /**
     * Test that the constructor throws when the filter is mis-configured.
     *
     * @return void
     * @expectedException \LogicException
     * @expectedExceptionMessage Invalid filter configured!
     */
    public function testIllegalFilter()
    {
        $validator = clone $this->validator;
        $reflection = new \ReflectionObject($validator);

        $property = $reflection->getProperty('filter');
        $property->setAccessible(true);
        $property->setValue($validator, null);
        $property->setAccessible(false);

        $reflection
            ->getConstructor()
            ->invoke($validator);
    }
Just call the constructor again on an already initialized and cloned object. No biggy ><
Jan-Marten de Boer
@johmanx10
Oct 25 2015 21:05
Yay, all done. Let's have weekend now... XD