public function collect()
    {
        $self = $this;
        $fileSystem = new FileSystem();
        $environment = $this->environment;
        $this->testTargetRepository->walkOnResources(function ($resource, $index, TestTargetRepository $testTargetRepository) use ($self, $fileSystem, $environment) {
            $absoluteTargetPath = $fileSystem->getAbsolutePath($resource, $environment->getWorkingDirectoryAtStartup());
            if (!file_exists($absoluteTargetPath)) {
                throw new \UnexpectedValueException(sprintf('The directory or file [ %s ] is not found', $absoluteTargetPath));
            }

            if (is_dir($absoluteTargetPath)) {
                $files = Finder::create()
                    ->files()
                    ->in($absoluteTargetPath)
                    ->depth($self->isRecursive() ? '>= 0' : '== 0')
                    ->sortByName();
                foreach ($files as $file) {
                    call_user_func(array($self, 'collectTestCasesFromFile'), $file->getPathname());
                }
            } else {
                call_user_func(array($self, 'collectTestCasesFromFile'), $absoluteTargetPath);
            }
        });

        return $this->suite;
    }
public function collect()
    {
        $self = $this;
        $fileSystem = new FileSystem();
        $environment = $this->environment;
        $this->testTargetRepository->walkOnResources(function ($resource, $index, TestTargetRepository $testTargetRepository) use ($self, $fileSystem, $environment) {
            $absoluteTargetPath = $fileSystem->getAbsolutePath($resource, $environment->getWorkingDirectoryAtStartup());
            if (!file_exists($absoluteTargetPath)) {
                throw new \UnexpectedValueException(sprintf('The directory or file [ %s ] is not found', $absoluteTargetPath));
            }

            if (is_dir($absoluteTargetPath)) {
                $files = Finder::create()
                    ->files()
                    ->in($absoluteTargetPath)
                    ->depth($self->isRecursive() ? '>= 0' : '== 0')
                    ->sortByName();
                foreach ($files as $file) {
                    call_user_func(array($self, 'collectTestCasesFromFile'), $file->getPathname());
                }
            } else {
                call_user_func(array($self, 'collectTestCasesFromFile'), $absoluteTargetPath);
            }
        });

        return $this->suite;
    }
public function collect ( ) { $ self = $ this ; $ fileSystem = new FileSystem ( ) ; $ environment = $ this -> environment ; $ this -> testTargetRepository -> walkOnResources ( function ( $ resource , $ index , TestTargetRepository $ testTargetRepository ) use ( $ self , $ fileSystem , $ environment ) { $ absoluteTargetPath = $ fileSystem -> getAbsolutePath ( $ resource , $ environment -> getWorkingDirectoryAtStartup ( ) ) ; if ( ! file_exists ( $ absoluteTargetPath ) ) { throw new \ UnexpectedValueException ( sprintf ( 'The directory or file [ %s ] is not found' , $ absoluteTargetPath ) ) ; } if ( is_dir ( $ absoluteTargetPath ) ) { $ files = Finder :: create ( ) -> files ( ) -> in ( $ absoluteTargetPath ) -> depth ( $ self -> isRecursive ( ) ? '>= 0' : '== 0' ) -> sortByName ( ) ; foreach ( $ files as $ file ) { call_user_func ( array ( $ self , 'collectTestCasesFromFile' ) , $ file -> getPathname ( ) ) ; } } else { call_user_func ( array ( $ self , 'collectTestCasesFromFile' ) , $ absoluteTargetPath ) ; } } ) ; return $ this -> suite ; }
Collects tests.

@return mixed

@throws \UnexpectedValueException
Collects tests .