Jyxo\Input\FactoryTest::testCustomValidatorPrefix PHP Method

testCustomValidatorPrefix() public method

Tests creating a validator instance with a custom prefix.
    public function testCustomValidatorPrefix()
    {
        $validatorName = 'Validator';
        $validatorPrefix = '\\SomeOtherPrefix\\Some\\';
        // Ensure that there is no such class loaded
        if (class_exists($validatorName, false)) {
            $this->markTestSkipped(sprintf('Class %s exists', $validatorName));
        }
        try {
            $this->factory->getValidatorByName($validatorName);
            $this->fail(sprintf('Expected exception %s.', \Jyxo\Input\Exception::class));
        } catch (\PHPUnit_Framework_ExpectationFailedException $e) {
            throw $e;
        } catch (\Exception $e) {
            $this->assertInstanceOf(\Jyxo\Input\Exception::class, $e);
        }
        $this->factory->addValidatorPrefix($validatorPrefix);
        $validator = $this->factory->getValidatorByName($validatorName);
    }