magento / magento/magento2-functional-testing-framework

Filesystem::remove() argument #1 must be string, SplFileInfo given

Open
#908 8 comments 0 reactions 1 assignee View on GitHub

@Nurgiel is already working on this.

Since Oct 11, 2023.

Dominant language
PHP
Stars
154
Forks
134
PR merge metrics
No merged PRs in 30d

Description

Hello, I'm getting an error when running `vendor/bin/mftf build:project`

I also managed to fix it my changing line 89 in vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Console/CleanProjectCommand.php from:
`$fileSystem->remove($file);` to `$fileSystem->remove($file->getRealPath());`

### Preconditions
1. PHP 8.1.23
2. Chrome Browser Version: 117.0.5938.132
3. ChromeDriver Version: 117.0.5938.149
4. composer.json
```
"name": "magento/magento-cloud-template",
"version": "2.4.6",
(...)
"require-dev": {
"allure-framework/allure-phpunit": "*",
"codeception/module-asserts": "*",
"codeception/module-phpbrowser": "*",
"magento/magento2-functional-testing-framework": "*",
"phpunit/phpunit": "*"
}
```

### Steps to reproduce
1. vendor/bin/mftf build:project

### Expected result
1. no error

### Actual result
```
PHP Fatal error: Uncaught TypeError: Symfony\Component\Filesystem\Filesystem::remove(): Argument #1 ($files) must be of type iterable|string, Symfony\Component\Finder\SplFileInfo given, called in /var/www/html/project-name/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Console/CleanProjectCommand.php on line 89 and defined in /var/www/html/project-name/vendor/symfony/filesystem/Filesystem.php:150
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.