function testGetErrorMessages()
 {
     $this->validator->validate('TEXU3070077');
     $result = $this->validator->getErrorMessages();
     $expected = array('Check digit is not match');
     $this->assertIdentical($result, $expected);
     $this->validator->validate('');
     $result = $this->validator->getErrorMessages();
     $expected = array('Container number must be a string');
     $this->assertIdentical($result, $expected);
     $myValidator = new ContainerNumberValidator();
     $myValidator->getOwnerCode();
     $myValidator->getProductGroupCode();
     $myValidator->getRegistrationDigit();
     $myValidator->getCheckDigit();
     $result = $myValidator->getErrorMessages();
     $expected = array('You must call validate or isValid first', 'You must call validate or isValid first', 'You must call validate or isValid first', 'You must call validate or isValid first');
     $this->assertIdentical($result, $expected);
     $this->validator->clearErrors();
     $this->validator->generate('EP', 'ZZ', 0, 1);
     $result = $this->validator->getErrorMessages();
     $expected = 'Invalid owner code or product group code';
     $this->assertIdentical($result[0], $expected);
     $this->validator->clearErrors();
     $this->validator->generate('EPX', 'U', -1, 2);
     $result = $this->validator->getErrorMessages();
     $expected = 'Invalid number to generate, minimal is 0 and maximal is 999999';
     $this->assertIdentical($result[0], $expected);
     $this->validator->clearErrors();
     $this->validator->generate('EPX', '9', 1, 2);
     $result = $this->validator->getErrorMessages();
     $expected = array('Invalid container number', 'Error generating container number at number 1');
     $this->assertIdentical($result, $expected);
 }
var_dump($validator->isValid('TEXU3070079'));
echo '<hr />';
echo '<h1>Example of invalid check digit : TEXU3070070</h1>';
// example of invalid container number, will return an empty array
$codeSegment = $validator->validate('TEXU3070070');
print_r($codeSegment);
var_dump($validator->isValid('TEXU3070070'));
// get error messages
var_dump($validator->getErrorMessages());
echo '<hr />';
echo '<h1>Example of getting owner code, product group code, registration digit and check digit from valid container number : TEXU3070079</h1>';
// validate() or isValid() must be called before getting segmentCode
if ($validator->isValid('TEXU3070079')) {
    echo 'Owner code: ' . implode('', $validator->getOwnerCode()) . '<br />';
    echo 'Product group code: ' . $validator->getProductGroupCode() . '<br />';
    echo 'Registration digit: ' . implode('', $validator->getRegistrationDigit()) . '<br />';
    echo 'Check digit: ' . $validator->getCheckDigit() . '<br />';
}
echo '<hr />';
echo '<h1>Example of creating check digit from container number without check digit: TEXU307007</h1>';
echo $validator->createCheckDigit('TEXU307007');
echo '<hr />';
echo '<h1>Example of generating container number from 1 to 100</h1>';
$start = xdebug_time_index();
// parameters are (left to right): owner code, product group code, number from, number to
var_dump($validator->generate('TEX', 'U', 1, 100));
$end = xdebug_time_index();
echo "\n Time to generate: " . ($end - $start) . " s";
echo '<hr />';
$end_all = xdebug_time_index();
echo "\n <h1>Time of all example: " . ($end_all - $start_all) . " s</h1>";