10 Commits

Author SHA1 Message Date
oleibman 645d9fea64 Phpstan Level 10 Prep Penultimate
Everything except Statistical.
2025-05-18 18:04:25 -07:00
oleibman d647fe7ee7 Use Php Attributes Rather than Annotations for PhpUnit
With PhpUnit 10 came the ability to use Php attributes rather than doc-block annotations for things like "data provider". PhpUnit 11 deprecates the use of annotations, and PhpUnit 12 will not not permit their use. Since PhpUnit 11 requires Php8.2+, we cannot adopt it as long as we support Php8.1, which will continue to be the case for some time. However, there is no penalty for early adoption.

Php-cs-fixer can use:
```
'php_unit_attributes' => ['keep_annotations' => false],
```
This allows us to run `composer fix` to automate all the needed changes. No manual changes were needed for any of the test members.

With this change, PhpUnit 9 can no longer be used with the test suite. File composer.json is updated to reflect that reality, and phpunit9.xml.dist, which has been supplied in case anyone needed to use PhpUnit 9, is no longer required, and is thus deleted. For now, PhpUnit 11 is not being added as a possibility.

No source code is changed in this PR.
2024-11-23 20:56:26 -08:00
Adrien Crivelli ec4098c8fd Strict mode for all tests
While we might never be able to have 100% of our code strict, we can at
the very least do it for all of our tests. This ensures that our tests
are using our API with the types as intended by the test author, and not
silently be cast to what our API requires.
2023-09-07 17:44:56 +08:00
oleibman e9cf27354d PhpUnit 10 Compatibility Part 2 (#3526)
Successor to PR #3523. There are 494 single-line changes (`public function provider` to `public static function provider`) in this PR. None of these were made manually; they were all created with the following script (adapted from
https://stackoverflow.com/questions/25909820/how-to-recursively-iterate-through-files-in-php):
```php
$dir = 'C:/git/unit10prep2/tests/PhpSpreadsheetTests';
$it = new RecursiveDirectoryIterator($dir);

// Loop through files
foreach(new RecursiveIteratorIterator($it) as $file) {
    if ($file->getExtension() === 'php') {
        $contents = file_get_contents($file);
        $new = preg_replace('/public function (\\w*)([Pp])rovider/', 'public static function $1$2rovider', $contents);
        if ($new !== $contents) {
            echo "changing $file\n";
            file_put_contents($file, $new);
        }
    }
}
```

After this PR, there will be one more, with a small number of test changes, and enabling PhpUnit 10 for Php 8.1+.
2023-04-20 13:48:00 -07:00
oleibman a0e6e09557 Resolve Phpstan Messages LookupRef TextData Coordinate ReferenceHelpe… (#3298)
* Resolve Phpstan Messages LookupRef TextData Coordinate ReferenceHelper RichText

Reduce number of Phpstan messages by addressing their issues.

* Scrutinizer

One legitimate observation, one unfathomable false positive.

* Scrutinizer (legitimate)

Reasonable simplification suggestion.
2023-01-27 09:15:08 -08:00
MarkBaker d0910bd263 Additional unit tests for invalid column name 2023-01-21 02:47:33 +01:00
MarkBaker e02439aeb1 For Structured References, an Invalid column reference should return an Excel #REF! error 2023-01-21 02:42:12 +01:00
MarkBaker 0e3f1f187d Use exception code rather than exception message to identify whether the Calc Engine should throw an exception or push to stack for Structured Reference Exceptions 2023-01-03 12:27:20 +01:00
MarkBaker 1bb0d56b15 Unhappy path for Structured References (referencing #Headers when headers are hidden) 2023-01-02 22:01:10 +01:00
MarkBaker 8d7130cbc8 Initial work on handling Structured References in the Calculation Engine 2022-12-23 23:41:15 +01:00