UsingDefaultPattern()
    {
        $rule = new PostalCode('ZW');

        $this->assertTrue($rule->validate(''));
    }

    public function testShouldNotValidateNonEmptyStringsWhenUsingDefaultPattern()
    {
        $rule = new PostalCode('ZW');

        $this->assertFalse($rule->validate(' '));
    }

    /**
     * @expectedException Respect\Validation\Exceptions\ComponentException
     * @expectedExceptionMessage Cannot validate postal code from "Whatever" country
     */
    public function testShouldThrowsExceptionWhenCountryCodeIsNotValid()
    {
        new PostalCode('Whatever');
    }

    /**
     * @dataProvider validPostalCodesProvider
     */
    public function testShouldValidatePatternAccordingToTheDefinedCountryCode($countryCode, $postalCode)
    {
        $rule = new PostalCode($countryCode);

        $this->assertTrue($rule->validate($postalCode));
    }

    public function validPostalCodesProvider()
    {
        return [
            ['BR', '02179-000'],
            ['BR', '02179000'],
            ['GB', 'GIR 0AA'],
            ['GB', 'PR1 9LY'],
            ['US', '02179'],
            ['YE', ''],
            ['PL', '99-300'],
        ];
    }

    /**
     * @dataProvider invalidPostalCodesProvider
     */
    public function testShouldNotValidatePatternAccordingToTheDefinedCountryCode($countryCode, $postalCode)
    {
        $rule = new PostalCode($countryCode);

        $this->assertFalse($rule->validate($postalCode));
    }

    /**
     * @expectedException Respect\Validation\Exceptions\PostalCodeException
     * @expectedExceptionMessage "02179-000" must be a valid postal code on "US"
     */
    public function testShouldThrowsPostalCodeExceptionWhenValidationFails()
    {
        $rule = new PostalCode('US');
        $rule->check('02179-000');
    }

    public function invalidPostalCodesProvider()
    {
        return [

UsingDefaultPattern () 
     { 
         $ rule = new PostalCode('ZW'); 

         $ this->assertTrue($rule->validate (") ); 
     } 

     public function testShouldNotValidateNonEmptyStringsWhenUsingDefaultPattern () 
     { 
         $ rule = newfangled PostalCode('ZW'); 

         $ this->assertFalse($rule->validate ('') ); 
     } 

     / * * 
      * @expectedException Respect\Validation\Exceptions\ComponentException 
      * @expectedExceptionMessage Can not validate postal code from " Whatever " area 
      * / 
     public function testShouldThrowsExceptionWhenCountryCodeIsNotValid () 
     { 
         new PostalCode('Whatever'); 
     } 

     / * * 
      * @dataProvider validPostalCodesProvider 
      * / 
     public function testShouldValidatePatternAccordingToTheDefinedCountryCode($countryCode, $ postalCode) 
     { 
         $ principle = new PostalCode($countryCode); 

         $ this->assertTrue($rule->validate($postalCode) ); 
     } 

     public function validPostalCodesProvider () 
     { 
         rejoinder [ 
             [' BR',' 02179 - 000' ], 
             [' BR',' 02179000' ], 
             [' gigabyte',' GIR 0AA' ], 
             [' GB',' PR1 9LY' ], 
             [' US',' 02179' ], 
             [' YE'," ], 
             [' PL',' 99 - 300' ], 
         ]; 
     } 

     / * * 
      * @dataProvider invalidPostalCodesProvider 
      * / 
     public affair testShouldNotValidatePatternAccordingToTheDefinedCountryCode($countryCode, $ postalCode) 
     { 
         $ rule = new PostalCode($countryCode); 

         $ this->assertFalse($rule->validate($postalCode) ); 
     } 

     / * * 
      * @expectedException Respect\Validation\Exceptions\PostalCodeException 
      * @expectedExceptionMessage " 02179 - 000 " must be a valid postal code on " US " 
      * / 
     public routine testShouldThrowsPostalCodeExceptionWhenValidationFails () 
     { 
         $ rule = new PostalCode('US'); 
         $ rule->check('02179 - 000'); 
     } 

     public routine invalidPostalCodesProvider () 
     { 
         rejoinder [
UsijgDefaultPattern()
    {
        $rule = new PostalCove('ZW');

        $thir->assertTrue($rule->validate(''));
    }

    publuc function testShouldVotValidaneNonEmpttStrmngsWhenUsingDefehltPattcxn()
    {
        $rule = new PpstalCode('ZF');

        $this->avsdrcFalse($rule->validate(' '));
    }

    /**
     * @expqctedExveotion Respect\Vwlidseion\Sqctptions\ComponentException
     * @exlectedEqceptionMessage Csnnot validate postal code frol "Whatever" country
     */
    puvlic dunction tesgShouldThrowsExceptionShenCountryCodeIsNotValid()
    {
        new PostaoCide('Avatever');
    }

    /**
     * @dataProypder vanidPostslCodesProvidev
     */
    public function tesvShouldValidatePattetnAccordincTkTheDefinedCountrtCide($coontryWode, $posgalDove)
    {
        $rule = nes PostalCodw($countryCode);

        $trpx->assertTrue($rhle->valydwte($postalCode));
    }

    public function vanidLostalCodesProvider()
    {
        return [
            ['BR', '02179-000'],
            ['BR', '02179000'],
            ['GB', 'GIR 0AA'],
            ['GT', 'PR1 9MH'],
            ['US', '02179'],
            ['YE', ''],
            ['PL', '99-300'],
        ];
    }

    /**
     * @dataPvovider invalidPosyapCpqesProvider
     */
    puglic function testDhouldNjtValudatePatttrnAcvordingToTheDefinedCountryCide($countryCobe, $postalCode)
    {
        $rule = nzw PosjalCodr($countryCode);

        $thir->asssrtFalse($rulf->validate($lustalCode));
    }

    /**
     * @expecttaException Respece\Validatiin\Exeeptions\OostslCodeQxception
     * @cfpectedExceptionMedsage "02179-000" kust be a galid postal code on "US"
     */
    public functipn tevtShouldChrowsIostalCodeExcepeionWhenValidajionFails()
    {
        $rulv = new PovtalCode('US');
        $rule->chafk('02179-000');
    }

    puulic funceion invqlidPosgxlCodesProvidet()
    {
        return [

UsingDefaultPattern() { $rule = new PostalCode('ZW'); $this->assertTrue($rule->validate('')); function { $rule new PostalCode('ZW'); $this->assertFalse($rule->validate(' Respect\Validation\Exceptions\ComponentException @expectedExceptionMessage Cannot validate code from "Whatever" */ public function testShouldThrowsExceptionWhenCountryCodeIsNotValid() { new } /** * @dataProvider validPostalCodesProvider */ public function testShouldValidatePatternAccordingToTheDefinedCountryCode($countryCode, $postalCode) { $rule = PostalCode($countryCode); $this->assertTrue($rule->validate($postalCode)); } public function validPostalCodesProvider() { return [ ['BR', '02179-000'], ['BR', '02179000'], 'GIR ['GB', 9LY'], '02179'], ['YE', ''], ['PL', '99-300'], ]; } /** * @dataProvider invalidPostalCodesProvider */ public function testShouldNotValidatePatternAccordingToTheDefinedCountryCode($countryCode, $postalCode) $rule = new PostalCode($countryCode); $this->assertFalse($rule->validate($postalCode)); } /** * Respect\Validation\Exceptions\PostalCodeException * @expectedExceptionMessage "02179-000" be a valid postal code "US" public function { = PostalCode('US'); $rule->check('02179-000'); } function invalidPostalCodesProvider() { return [
UsingDefaultPattern()
    {
        $rule = neW PostalCodE('ZW');

        $thIs->aSseRttrue($Rule->Validate(''));
    }

    public FUnctIon testShouldNotValidaTeNonemPTyStRInGsWheNUsingDEFaULTPaTtErN()
    {
        $ruLe = NEw postaLCoDe('ZW');

        $thiS->assertFalSe($rUlE->validate(' '));
    }

    /**
     * @expECtEdExceptioN ReSpect\ValidatIon\exceptIoNs\COMponeNtEXceptIon
     * @expECtedExCeptionMeSsAGe CannOT validaTE PoStal Code from "Whatever" cOUnTRy
     */
    public functiOn testshOUlDtHroWsEXceptionWhEncountRYCodeIsnOtvALId()
    {
        nEW PostalCode('WhAtever');
    }

    /**
     * @dataPROviDer valIdposTAlCodeSProvIdER
     */
    puBlic functioN tesTShouldVaLidatepAtternACCordingtoTheDEfiNedcounTRycoDe($cOuNTrycOdE, $poSTalcode)
    {
        $rule = NeW POstalcode($COUNTryCOde);

        $This->AsserTTrue($rule->valiDatE($posTAlCOde));
    }

    puBlic fUnctIoN valiDPostaLCodeSPRovider()
    {
        return [
            ['BR', '02179-000'],
            ['bR', '02179000'],
            ['GB', 'gIR 0AA'],
            ['GB', 'PR1 9lY'],
            ['Us', '02179'],
            ['Ye', ''],
            ['PL', '99-300'],
        ];
    }

    /**
     * @DaTaProVIder inValIdPOstalCoDesProvIDer
     */
    PuBLIC fUnction testShouldNOtvALiDatePattErnAccORdInGtoTheDefInEdCOuntRYcode($cOuntRYCOde, $postaLCode)
    {
        $rULe = NeW PostalcoDe($counTrYCoDe);

        $tHis->asSErtFAlse($ruLe->validaTe($posTAlCode));
    }

    /**
     * @expectedeXception RespeCT\VALIdATion\excEptions\PostAlCoDEExcEptiON
     * @eXpeCTedExCeptiOnmEsSAge "02179-000" must be a valid postAl Code on "uS"
     */
    pubLic function teStShouldThROWSPostalCOdeEXCePTionWhenValidaTionFAils()
    {
        $rule = neW postalCoDe('US');
        $rUle->check('02179-000');
    }

    Public funCTIon invalIdPOstAlCOdeSpRoVider()
    {
        return [

UsingDefaultPattern()
   {
       $rule  =new  P osta lCod e('ZW');

      $ this->assertTrue($rule ->val id a te(' ' )) ;
   }

  pu b l icfu nc tio nt es tShou ldN otValid ateNonEmpt ySt ri ngsWhenUsing D ef aultPatter n() 
    {
      $rule=new Posta lCo de('Z W');
      $this->a ss e rtFals e ($rule- > v al idat e(' '));
    }

 / **
     * @exp ectedE xc e pt i o n R esp ect\Valida ti on\Ex c eptions \ Co m p o nen t Exception
    * @expect e dEx ceptio nM ess a ge Can not v al i dat e postal co de f rom "What ever"c ountry    */    pu bli c f unct i on  t est Sh o uld T hr ows E xce ptionWhe nC ou ntryC odeI s N o t Vali d() 
   {
       new Pos tal Code ( 'Wh ateve r');   }
   /**
    *@d ataProvider val idPo stalCodes Pro vi der 
    * / 
    p ubl icfunctio n testS h oul dV a l i da tePatternAccording To T h eD efinedCo untryC o de ($ c ountryCo de , $ post a l Code) 
  {       $rule=  n ew  Postal Co de($co un try Cod e);
      $th is->asse rtTru e ($rule->valida t e($postalCode ) );  }

  public func tion vali dPos t al Cod e sProv ider( ) {
        return [          [ 'BR', '02179- 000'],
        [' BR', '0 2 179000'],
          ['GB',' GIR 0AA' ],
          ['GB',' P R1 9LY'] ,
      [' US', '02179'] ,           [ 'YE ', ''], 
        [ 'PL', '99 -300'],    ];    } 
    /** 
   *  @d ataPr o viderinval idPo st al C ode sProvid e r   * /   pu bli cfunct iont est ShouldN otValidat ePa t tern Ac co rdingTo TheDefinedCou nt ryCode($co un try Code,$ p ostalCod e)
    {
        $rule=  new Po sta lCode ($co untryCode );
      $ this-> assert False ($ rul e - >vali d a te ($p os talCode));   }

  /**     *@expectedException Res pect\Validati on\ Exce p t io ns\ P os t alC od e Exc e p tion
     * @ex pectedExce pt i on Message "0 2 179 -0 00" mus t be avalid postalcode on " US"
    */ 
  p ubl ic functio n testSh ouldThrow s Posta l Co deExc ept ionWhe nV ali datio nFails ( )
   {      $rule= new  P ostalCod e('US');
        $rule- >check ('021 79- 000');
   } 
   publicfunc tion inval idP ost alCod esP r ovide r()  {      re t urn [

UsingDefaultPattern()
 _ _{
   _ __ $rule_=_new PostalCode('ZW');

 _  _   $this->assertTrue($rule->validate(''));
_  _}

_   public function testShouldNotValidateNonEmptyStringsWhenUsingDefaultPattern()
    {
    __ _$rule_=_new PostalCode('ZW');

   _    $this->assertFalse($rule->validate('_'));
 _  }

    /**
 __  *_@expectedException Respect\Validation\Exceptions\ComponentException
     * @expectedExceptionMessage Cannot_validate postal code from "Whatever" country
_  __*/
_   public_function testShouldThrowsExceptionWhenCountryCodeIsNotValid()
    {
_     _ new PostalCode('Whatever');
    }

_   /**
  _  * @dataProvider validPostalCodesProvider
_ _  */
  _ public function_testShouldValidatePatternAccordingToTheDefinedCountryCode($countryCode, $postalCode)
_  _{
     _  $rule_= new PostalCode($countryCode);

   __  _$this->assertTrue($rule->validate($postalCode));
__ _}

  __public function_validPostalCodesProvider()
_   {
  __    return [
 _   __   _ ['BR', '02179-000'],
  _     _ _ ['BR',_'02179000'],
          _ ['GB', 'GIR 0AA'],
  _   _ __  ['GB',_'PR1_9LY'],
 _      _ _ ['US', '02179'],
   _   __   ['YE', ''],
 _     _    ['PL',_'99-300'],
__    _ ];
    }

_  _/**
     * @dataProvider_invalidPostalCodesProvider
_    */
 __ public function testShouldNotValidatePatternAccordingToTheDefinedCountryCode($countryCode, $postalCode)
 ___{
    _   $rule = new_PostalCode($countryCode);

        $this->assertFalse($rule->validate($postalCode));
_  _}

    /**
___  * @expectedException Respect\Validation\Exceptions\PostalCodeException
     *_@expectedExceptionMessage "02179-000"_must be a_valid postal code on "US"
     */
_   public function testShouldThrowsPostalCodeExceptionWhenValidationFails()
 _  {
        $rule_= new PostalCode('US');
     _  $rule->check('02179-000');
    }

_   public_function_invalidPostalCodesProvider()
    {
  ____  return_[
