tests/unit/Subjects/FilesystemTraitTest.php
/**
     * Test the resolvePath() method with an invalid path.
     *
     * @return void
     */
Test the resolvePath() method with an invalid path.
@return void
Test the resolvePath () method with an invalid path . @return void
public function testResolvePathWithInvalidPath()
    {
        $this->expectException(\Exception::class);
        $this->expectExceptionMessage("Directory test.txt doesn't exist");
        $mockFilesystem = $this->getMockBuilder('TechDivision\Import\Adapter\FilesystemAdapterInterface')
                               ->setMethods(get_class_methods('TechDivision\Import\Adapter\FilesystemAdapterInterface'))
                               ->getMock();
        $mockFilesystem->expects($this->exactly(2))
                       ->method('isDir')
                       ->withConsecutive(
                               array($filename = 'test.txt'),
                               array(getcwd() . DIRECTORY_SEPARATOR . $filename)
                           )
                           ->willReturnOnConsecutiveCalls(false, false);
        $this->filesystemTrait->setFilesystemAdapter($mockFilesystem);
        $this->filesystemTrait->resolvePath($filename);
    }
public function testResolvePathWithInvalidPath ( ) { $ this -> expectException ( \ Exception :: class ) ; $ this -> expectExceptionMessage ( " Directory test.txt doesn't exist " ) ; $ mockFilesystem = $ this -> getMockBuilder ( 'TechDivision\Import\Adapter\FilesystemAdapterInterface' ) -> setMethods ( get_class_methods ( 'TechDivision\Import\Adapter\FilesystemAdapterInterface' ) ) -> getMock ( ) ; $ mockFilesystem -> expects ( $ this -> exactly ( 2 ) ) -> method ( 'isDir' ) -> withConsecutive ( array ( $ filename = 'test.txt' ) , array ( getcwd ( ) . DIRECTORY_SEPARATOR . $ filename ) ) -> willReturnOnConsecutiveCalls ( false , false ) ; $ this -> filesystemTrait -> setFilesystemAdapter ( $ mockFilesystem ) ; $ this -> filesystemTrait -> resolvePath ( $ filename ) ; }
Test the resolvePath() method with an invalid path.
Test the resolvePath () method with an invalid path .
// mock the filesystem // set the mock filesystem // query whether or not the path will be resolved