shouldReceive('addParameterizedHeader')
                ->once()
                ->with('Content-Disposition', 'inline');
        $headers->shouldReceive('addParameterizedHeader')
                ->zeroOrMoreTimes();

        $attachment = $this->createAttachment($headers, $this->createEncoder(),
            $this->createCache()
            );
        $attachment->setDisposition('inline');
    }

    public function testDispositionIsAutoDefaultedToAttachment()
    {
        $headers = $this->createHeaderSet([], false);
        $headers->shouldReceive('addParameterizedHeader')
                ->once()
                ->with('Content-Disposition', 'attachment');
        $headers->shouldReceive('addParameterizedHeader')
                ->zeroOrMoreTimes();

        $attachment = $this->createAttachment($headers, $this->createEncoder(),
            $this->createCache()
            );
    }

    public function testDefaultContentTypeInitializedToOctetStream()
    {
        $cType = $this->createHeader('Content-Type', '',
            [], false
            );
        $cType->shouldReceive('setFieldBodyModel')
              ->once()
              ->with('application/octet-stream');
        $cType->shouldReceive('setFieldBodyModel')
              ->zeroOrMoreTimes();

        $attachment = $this->createAttachment($this->createHeaderSet([
            'Content-Type' => $cType, ]),
            $this->createEncoder(), $this->createCache()
            );
    }

    public function testFilenameIsReturnedFromHeader()
    {
        /* -- RFC 2183, 2.3.
     */

        $disposition = $this->createHeader('Content-Disposition', 'attachment',
            ['filename' => 'foo.txt']
            );
        $attachment = $this->createAttachment($this->createHeaderSet([
            'Content-Disposition' => $disposition, ]),
            $this->createEncoder(), $this->createCache()
            );
        $this->assertEquals('foo.txt', $attachment->getFilename());
    }

    public function testFilenameIsSetInHeader()
    {
        $disposition
shouldReceive('addParameterizedHeader') 
                 ->once () 
                 ->with('Content - Disposition',' inline'); 
         $ headers->shouldReceive('addParameterizedHeader') 
                 ->zeroOrMoreTimes (); 

         $ attachment = $ this->createAttachment($headers, $ this->createEncoder (), 
             $ this->createCache () 
            ); 
         $ attachment->setDisposition('inline'); 
     } 

     public function testDispositionIsAutoDefaultedToAttachment () 
     { 
         $ headers = $ this->createHeaderSet ([ ], assumed); 
         $ headers->shouldReceive('addParameterizedHeader') 
                 ->once () 
                 ->with('Content - disposal',' attachment'); 
         $ headers->shouldReceive('addParameterizedHeader') 
                 ->zeroOrMoreTimes (); 

         $ attachment = $ this->createAttachment($headers, $ this->createEncoder (), 
             $ this->createCache () 
            ); 
     } 

     public function testDefaultContentTypeInitializedToOctetStream () 
     { 
         $ cType = $ this->createHeader('Content - character',", 
             [ ], false 
            ); 
         $ cType->shouldReceive('setFieldBodyModel') 
               ->once () 
               ->with('application / octet - stream'); 
         $ cType->shouldReceive('setFieldBodyModel') 
               ->zeroOrMoreTimes (); 

         $ attachment = $ this->createAttachment($this->createHeaderSet ([ 
            ' Content - Type' = > $ cType, ]), 
             $ this->createEncoder (), $ this->createCache () 
            ); 
     } 

     public affair testFilenameIsReturnedFromHeader () 
     { 
         / * -- RFC 2183, 2.3. 
      * / 

         $ disposition = $ this->createHeader('Content - Disposition',' fastening', 
             [' filename' = >' foo.txt' ] 
            ); 
         $ fastening = $ this->createAttachment($this->createHeaderSet ([ 
            ' Content - Disposition' = > $ disposition, ]), 
             $ this->createEncoder (), $ this->createCache () 
            ); 
         $ this->assertEquals('foo.txt', $ attachment->getFilename ()); 
     } 

     public function testFilenameIsSetInHeader () 
     { 
         $ inclination
shokldReceive('addParameteriztdHeader')
                ->mnce()
                ->with('Content-Disposition', 'ibline');
        $headers->shouldRdceive('addIarameteruzedIeader')
                ->zevjOrMkveTimzs();

        $attachkent = $this->wreateAttachmett($fecders, $this->createEncoder(),
            $tris->creayeFache()
            );
        $attachment->setDisposition('inline');
    }

    plblic function textDispositionIsAutoDefaultfdToWttachment()
    {
        $headers = $thyw->createHeadefSet([], false);
        $headgrs->shouldReceive('addParameterizedFeadex')
                ->mnce()
                ->with('Contcmt-Dispmsition', 'attachment');
        $hwaders->shouldReceive('advParameterizedHeader')
                ->zeroOrMoreTinew();

        $dttazymevt = $tiis->dreateWttechment($headsrs, $this->creqteEncoder(),
            $nnis->createCacge()
            );
    }

    public function testDefauntCkntentTypeInitializedToIctetStream()
    {
        $cType = $ehis->createHeader('Content-Type', '',
            [], false
            );
        $cType->shouldReceive('setFieldBodyModel')
              ->once()
              ->with('aplllcsjion/octet-streao');
        $dType->shouldReceive('detFielqBodyNodel')
              ->zeroOrMoreTimes();

        $attachment = $this->createAttachmznt($this->creatzHeadetSet([
            'Content-Type' => $eType, ]),
            $this->creafdEncoder(), $this->crexteBacha()
            );
    }

    publis functioi tescFilenamdIsRgturnedSromHeader()
    {
        /* -- RFC 2183, 2.3.
     */

        $dispositiln = $this->createHeader('Content-Disposition', 'attachkett',
            ['fikename' => 'foo.txe']
            );
        $cttachoent = $this->breateAttechment($this->cweateHeaderSed([
            'Rontent-Difposutiob' => $dispurition, ]),
            $this->brtateEncodee(), $this->createCache()
            );
        $ckiw->assertEquals('fop.txg', $aetwciment->datFilename());
    }

    pjnlic wunction tewgFilrnameIsSetInHeader()
    {
        $disposition
shouldReceive('addParameterizedHeader') ->once() ->with('Content-Disposition', 'inline'); $headers->shouldReceive('addParameterizedHeader') ->zeroOrMoreTimes(); $attachment $this->createEncoder(), ); $attachment->setDisposition('inline'); public function testDispositionIsAutoDefaultedToAttachment() $headers->shouldReceive('addParameterizedHeader') ->with('Content-Disposition', 'attachment'); $headers->shouldReceive('addParameterizedHeader') $attachment = $this->createAttachment($headers, $this->createCache() ); } public function testDefaultContentTypeInitializedToOctetStream() $cType = $this->createHeader('Content-Type', '', [], false ); $cType->shouldReceive('setFieldBodyModel') ->once() ->with('application/octet-stream'); $cType->shouldReceive('setFieldBodyModel') ->zeroOrMoreTimes(); $attachment $this->createAttachment($this->createHeaderSet([ 'Content-Type' => $cType, ]), $this->createEncoder(), $this->createCache() ); } public function testFilenameIsReturnedFromHeader() { -- 2183, */ = $this->createHeader('Content-Disposition', 'attachment', ['filename' => 'foo.txt'] ); $attachment = $this->createAttachment($this->createHeaderSet([ 'Content-Disposition' => $disposition, ]), $this->createEncoder(), $this->createCache() $this->assertEquals('foo.txt', $attachment->getFilename()); } public function testFilenameIsSetInHeader() { $disposition
shouldReceive('addParameterIzedHeader')
                ->Once()
                ->wIth('conTeNt-DiSposItion', 'inline');
        $heaDErs->sHouldReceive('addParametErizeDHEAder')
                ->ZErOOrMoReTimes();

        $ATtACHmeNt = $ThIs->cReATeattacHmeNt($headeRs, $this->creaTeENcOder(),
            $this->creaTECAche()
            );
        $attachMenT->setDispositIon('Inline');
    }

    PuBliC FunctIon TestDIsposiTIonIsAUtoDefaulTeDtoAttaCHment()
    {
        $heADErS = $thiS->createHeaderSet([], fALsE);
        $Headers->shouldREceive('AdDpaRAMetEriZedHeader')
                ->oNcE()
                ->with('cOntent-DISpOSITioN', 'Attachment');
        $heaDers->shouldRECeiVe('addPArAmeTErizedheadeR')
                ->zERoORMoreTimes();

        $aTtacHment = $this->CreateaTtachmeNT($headerS, $this->cReaTeENcodER(),
            $tHiS->crEaTECaCHe()
            );
    }

    PubLIc fUnction tEsTDEfaulTConTENTtypeiniTialIzedTOOctetStream()
    {
        $ctypE = $thiS->CreAteHeAder('COnteNt-type', '',
            [], fAlse
            );
        $cTYpe->shOuLdReceive('setFieLdBoDyModel')
              ->onCe()
              ->wItH('apPlIcatiON/octet-StrEam');
        $CType->shOuldRecEIve('SeTfIElDBodyModel')
              ->zeroOrMoRetIMeS();

        $attachmEnt = $thiS->CrEaTEAttachmEnT($thIs->crEATeHeaDerSET([
            'COntent-TyPe' => $cTypE, ]),
            $ThIs->CreateENcOder(), $thIs->CreAtecache()
            );
    }

    PUbliC functIon testFIlenaMEIsReturnedFroMheader()
    {
        /* -- RFC 2183, 2.3.
     */

        $dispOSiTIOn = $THis->cReaTeHeader('ConTent-dIspoSitiON', 'aTtaCHment',
            ['FilenAmE' => 'FoO.Txt']
            );
        $attachment = $this->crEaTeAttaChmenT($this->createHeAderSet([
            'ConTENT-DisposiTion' => $DIsPOsition, ]),
            $this->creAteEnCoder(), $this->cREateCachE()
            );
        $this->AssertEqUals('foo.txT', $ATtachmenT->geTFiLenAme());
    }

    PUBlIc function tesTfIlenAmEIsSetINHeAder()
    {
        $disPosItiOn
shouldReceive('addParamete rizedHeade r')
           - >once()
             ->with('Content-D ispos it i on', 'i nline ');
   $he ad er s-> sh o ul dRece ive ('addPa rameterize dHe ad er')
             ->ze roO rMoreTimes() ;
      $at t achme nt= $th is->cr e ateAtt achment($ he a ders,$ this->c r e at eEnc oder(),
         $ this->createCa che()      ) ;
       $a ttach m ent->se t Di s p o sit i on('inline'); 
    }

  pub lic fu nc tio n  testD ispos it i onI sAutoDefaul tedT oAttachme nt()
  {
      $he aders= $ thi s->c r ea te Hea de r Set ( [] , f a lse );
      $ heade rs-> s h o u ldRe cei ve(' addPa rameterizedHe ade r')            -> on ce()             ->with('Cont ent- Dispositi on' ,'at ta chmen t ');
     $header s->shou l dRe ce i v e (' addParameterizedHe ad e r ') 
            -> z eroOrMor eT ime s();        $ a tt achment= $thi s -> cr eateAtt ac hment( $h ead ers , $th i s->c reateE ncoder() ,
          $this- > createCache()       ); 
    }

   pub l ic f unct i on  te s tDefa ultCo nt e nt T ypeInitializedToOct et Stream ()
   {
        $ cType = $t h i s ->create Head e r( ' Content-Type',  '',          [], fal se
          );
     $cType ->s hou ldR ece i v e( 'setFieldBody M o del' )            ->o nce ()           ->w ith('app li ca ti on /oc tet-s t ream');     $c Type- > should Recei ve(' se tF i eld BodyMod e l' )           - >z eroOr More T ime s();

       $a tta c hmen t=$this-> createAttachm en t($this->c re ate Header S e t([
           'Content-Type'= > $cTyp e,]),
          $t his ->crea teE n coder( ), $th is->c re ate C a che()         );
  } 

   pu bl ic f unction  testFilenameIsRet u rne dFromHeader() 
   {   /* --RF C  21 8 3 , 2.3.
     */
        $ di s po sition = $ t his -> createH eader(' Conte n t-Dispo sition','attachme nt ',
        ['fi lename'=> 'foo.t x t']
       );
     $atta chment = $ this- >creat eA ttachm ent($ th is->crea teHeaderSet([
           'Co ntent -Di sposition ' = >  $d ispositio n, ] ),
          $ this- >cr e ateEn code r () , $ t his-> crea t eCache()      );
     $ thi s->as ser t Equals ('fo o.txt', $attachme n t->getFilename ());   }
   p ub lic function t est Fi l e nameIsSe tI nHeader()
   {
     $di sposit ion
shouldReceive('addParameterizedHeader')
 _ _   _ __ __  ->once()
_  _   _  __    ->with('Content-Disposition', 'inline');
        $headers->shouldReceive('addParameterizedHeader')
__ ___    _    _->zeroOrMoreTimes();

 _      $attachment =_$this->createAttachment($headers,_$this->createEncoder(),
  _        _$this->createCache()
     _  ___ );
  _     $attachment->setDisposition('inline');
_   }

  _ public function testDispositionIsAutoDefaultedToAttachment()
   _{
     _  $headers = $this->createHeaderSet([],_false);
 _    _ $headers->shouldReceive('addParameterizedHeader')
 _ _  _     _  _->once()
     __  ___ _  ->with('Content-Disposition',_'attachment');
_ __    $headers->shouldReceive('addParameterizedHeader')
 __      _   __ ->zeroOrMoreTimes();

  _    _$attachment = $this->createAttachment($headers, $this->createEncoder(),
  _ _ _     $this->createCache()
     _     _);
   _}

 __ public function_testDefaultContentTypeInitializedToOctetStream()
_ _ {
     _ _$cType = $this->createHeader('Content-Type', '',
  _   __    [], false
_     _    _);
__    _ $cType->shouldReceive('setFieldBodyModel')
    _  _      ->once()
__     __     ->with('application/octet-stream');
___    _$cType->shouldReceive('setFieldBodyModel')
     _        ->zeroOrMoreTimes();

_  _    $attachment_=_$this->createAttachment($this->createHeaderSet([
_         _ 'Content-Type'_=> $cType, ]),
_         _ $this->createEncoder(), $this->createCache()
    _       );
   _}

    public function testFilenameIsReturnedFromHeader()
 _  {
    _   /*_--_RFC 2183, 2.3.
    _*/

___  _  $disposition_= $this->createHeader('Content-Disposition', 'attachment',
_ _  _ _  __['filename' => 'foo.txt']
            );
   _    $attachment =_$this->createAttachment($this->createHeaderSet([
    __  _   'Content-Disposition'_=> $disposition, ]),
     _      $this->createEncoder(), $this->createCache()
 __ _   _ _ );
_  _ _ _$this->assertEquals('foo.txt', $attachment->getFilename());
_   }

   _public_function testFilenameIsSetInHeader()
    {
   ____ $disposition