issue#27 - Tidy some misplaced unit tests
MODIFY
test/AbstractTest.php
test/AbstractTest.php
@@ -65,11 +65,6 @@ class AbstractTest extends TestCase
$this->assertNull($this->validator->getTranslator());
}
- public function testGlobalDefaultTranslatorNullByDefault()
- {
- $this->assertNull(AbstractValidator::getDefaultTranslator());
- }
-
public function testErrorMessagesAreTranslatedWhenTranslatorPresent()
{
if (! extension_loaded('intl')) {

MODIFY
test/StaticValidatorTest.php
test/StaticValidatorTest.php
namespace ZendTest\Validator;
use PHPUnit\Framework\TestCase;
-use Zend\Validator\AbstractValidator;
use Zend\I18n\Validator\Alpha;
+use Zend\ServiceManager\Exception\ServiceNotFoundException;
+use Zend\ServiceManager\ServiceManager;
+use Zend\Validator\AbstractValidator;
use Zend\Validator\Between;
-use Zend\Validator\StaticValidator;
use Zend\Validator\ValidatorPluginManager;
-use Zend\ServiceManager\ServiceManager;
+use Zend\Validator\StaticValidator;
/**
* @group Zend_Validator
@@ -167,4 +168,19 @@ class StaticValidatorTest extends TestCase
$this->expectExceptionMessage('options');
StaticValidator::execute($value, $validator, $options);
}
+
+ /**
+ * Ensures that if we specify a validator class basename that doesn't
+ * exist in the namespace, is() throws an exception.
+ *
+ * Refactored to conform with ZF-2724.
+ *
+ * @group ZF-2724
+ * @return void
+ */
+ public function testStaticFactoryClassNotFound()
+ {
+ $this->expectException(ServiceNotFoundException::class);
+ StaticValidator::execute('1234', 'UnknownValidator');
+ }
}

MODIFY
test/ValidatorChainTest.php
test/ValidatorChainTest.php
@@ -15,7 +15,6 @@ use Zend\Validator\Between;
use Zend\Validator\NotEmpty;
use Zend\Validator\StaticValidator;
use Zend\Validator\ValidatorChain;
-use Zend\ServiceManager\Exception\ServiceNotFoundException;
use Zend\Validator\ValidatorInterface;
use Zend\Validator\GreaterThan;
@@ -100,39 +99,6 @@ class ValidatorChainTest extends TestCase
$this->assertEquals(['error' => 'validation failed'], $this->validator->getMessages());
}
- /**
- * Ensures that if we specify a validator class basename that doesn't
- * exist in the namespace, is() throws an exception.
- *
- * Refactored to conform with ZF-2724.
- *
- * @group ZF-2724
- * @return void
- */
- public function testStaticFactoryClassNotFound()
- {
- $this->expectException(ServiceNotFoundException::class);
- StaticValidator::execute('1234', 'UnknownValidator');
- }
-
- public function testSetGetMessageLengthLimitation()
- {
- AbstractValidator::setMessageLength(5);
- $this->assertEquals(5, AbstractValidator::getMessageLength());
-
- $valid = new Between(1, 10);
- $this->assertFalse($valid->isValid(24));
- $message = current($valid->getMessages());
- $this->assertLessThanOrEqual(5, strlen($message));
- }
-
- public function testSetGetDefaultTranslator()
- {
- $translator = new TestAsset\Translator();
- AbstractValidator::setDefaultTranslator($translator);
- $this->assertSame($translator, AbstractValidator::getDefaultTranslator());
- }
-
public function testAllowsPrependingValidators()
{
$this->validator->attach($this->getValidatorTrue())

issue#27 - Tidy some misplaced unit tests