@@ -687,49 +687,6 @@ public function testAfterDeleteWithProtectedFieldName()
687687 $ this ->assertTrue ($ behavior ->afterDelete (new Event ('fake.event ' ), $ this ->entity , new ArrayObject ()));
688688 }
689689
690- public function testAfterDeleteWithNoFile ()
691- {
692- $ dir = '/some/path/ ' ;
693-
694- $ methods = array_diff ($ this ->behaviorMethods , ['afterDelete ' , 'config ' , 'setConfig ' , 'getConfig ' ]);
695- $ behavior = $ this ->getMockBuilder ('Josegonzalez\Upload\Model\Behavior\UploadBehavior ' )
696- ->onlyMethods ($ methods )
697- ->setConstructorArgs ([$ this ->table , $ this ->settings ])
698- ->getMock ();
699- $ behavior ->setConfig ($ this ->configOk );
700-
701- $ this ->entity ->expects ($ this ->once ())
702- ->method ('has ' )
703- ->with ('dir ' )
704- ->will ($ this ->returnValue (false ));
705-
706- $ this ->entity ->expects ($ this ->exactly (2 ))
707- ->method ('get ' )
708- ->with ('field ' )
709- ->will ($ this ->returnValue (null ));
710-
711- $ behavior ->expects ($ this ->once ())
712- ->method ('getPathProcessor ' )
713- ->with ($ this ->entity , null , 'field ' , $ this ->configOk ['field ' ])
714- ->willReturn ($ this ->processor );
715-
716- $ this ->processor ->expects ($ this ->once ())
717- ->method ('basepath ' )
718- ->willReturn ($ dir );
719-
720- $ behavior ->expects ($ this ->once ())
721- ->method ('getWriter ' )
722- ->with ($ this ->entity , null , 'field ' , $ this ->configOk ['field ' ])
723- ->willReturn ($ this ->writer );
724-
725- $ this ->writer ->expects ($ this ->once ())
726- ->method ('delete ' )
727- ->with ([$ dir ])
728- ->willReturn ([false ]);
729-
730- $ behavior ->afterDelete (new Event ('fake.event ' ), $ this ->entity , new ArrayObject ());
731- }
732-
733690 public function testGetWriter ()
734691 {
735692 $ processor = $ this ->behavior ->getWriter ($ this ->entity , new UploadedFile (fopen ('php://temp ' , 'rw+ ' ), 1 , UPLOAD_ERR_OK , 'file.txt ' ), 'field ' , []);
@@ -826,6 +783,12 @@ public function testGetPathProcessor()
826783 $ this ->assertInstanceOf ('Josegonzalez\Upload\File\Path\ProcessorInterface ' , $ processor );
827784 }
828785
786+ public function testGetPathProcessorWithNoFile ()
787+ {
788+ $ processor = $ this ->behavior ->getPathProcessor ($ this ->entity , null , 'field ' , []);
789+ $ this ->assertInstanceOf ('Josegonzalez\Upload\File\Path\ProcessorInterface ' , $ processor );
790+ }
791+
829792 public function testNameCallback ()
830793 {
831794 $ table = $ this ->getTableLocator ()->get ('Files ' );
0 commit comments