tests/unit/Subjects/AbstractSubjectTest.php
/**
     * Test the import() method with a matching filename and an existing .inProgress flag file.
     *
     * @return void
     */
Test the import() method with a matching filename and an existing .inProgress flag file.
@return void
Test the import () method with a matching filename and an existing . inProgress flag file . @return void
public function testImportWithMatchingFilenameButExistingInProgressFile()
    {
        $filename = 'product-import_20170706-160000_01.csv';
        $this->abstractSubject
             ->expects($this->once())
             ->method('isFile')
             ->with(sprintf('%s.failed', $filename))
             ->willReturn(true);
        $this->abstractSubject
             ->getSystemLogger()
             ->expects($this->once())
             ->method('debug')
             ->with(sprintf('Import running, found inProgress file "%s"', sprintf('%s.inProgress', $filename)))
             ->willReturn(null);
        $this->abstractSubject->import(uniqid(), $filename);
    }
public function testImportWithMatchingFilenameButExistingInProgressFile ( ) { $ filename = 'product-import_20170706-160000_01.csv' ; $ this -> abstractSubject -> expects ( $ this -> once ( ) ) -> method ( 'isFile' ) -> with ( sprintf ( '%s.failed' , $ filename ) ) -> willReturn ( true ) ; $ this -> abstractSubject -> getSystemLogger ( ) -> expects ( $ this -> once ( ) ) -> method ( 'debug' ) -> with ( sprintf ( 'Import running, found inProgress file "%s"' , sprintf ( '%s.inProgress' , $ filename ) ) ) -> willReturn ( null ) ; $ this -> abstractSubject -> import ( uniqid ( ) , $ filename ) ; }
Test the import() method with a matching filename and an existing .inProgress flag file.
Test the import () method with a matching filename and an existing . inProgress flag file .
// set the filename // mock the isFile() method // mock the system loggers debug() method // try to import the file with the passed name