13 Commits

Author SHA1 Message Date
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 ac5299b5df Minor Fix for AND/OR/XOR (#3287)
* Minor Fix for AND/OR/XOR

These 3 fall into the set of functions where Excel treats string literals differently depending on whether they are passed to the function directly or as a cell reference. PhpSpreadsheet is updated to try to duplicate that logic. New tests are added. Some existing test results had to change as a result of this code change.

* Adopt A Suggestion From Mark Baker

Reduce if statements by adding functions.
2023-01-16 05:35:28 -08:00
oleibman 3697352e28 Fix Unintential Deprecated Calls in Tests - LOGICAL (#3178)
* Fix Unintential Deprecated Calls in Tests - LOGICAL

I think it's best to install these before PR #3166. There are no changes to source code, only to doc-blocks and to test members which continue to inadvertently use calls to deprecated functions.

* Change Unit Tests to Run in Spreadsheet Context

They had been run as direct calls, which is not how most users would use them. Making this change exposed some minor coding errors - SWITCH needs to flatten its arguments, and IFERROR and IFNA were not handling a null testValue in the same manner as Excel.
2022-11-23 07:49:28 -08:00
Mark Baker 0371ccb686 Convert all relevant Logical functions to support array arguments (#2600) 2022-02-18 02:56:23 +01:00
Adrien Crivelli 49f87de165 Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
Dawid Warmuz 859bef1901 Add support for IFS() logical function (#1442)
* Add support for IFS() logical function

* Use Exception as false value in IFS logical function, so it never collides with string in spreadsheet
2020-06-20 18:21:19 +02:00
Adrien Crivelli fcd9f10663 Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
Fräntz Miccoli 445cc18e39 Fix IF implementation to comply with Excel behavior
Closes #1165
2019-11-17 18:26:33 +01:00
Mark Baker 1c6f0b8a9d Improved tests (#1110)
* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* New statistical tests

* Sniffs

* Additional statistical function unit tests

* Additional statistical function unit tests

* Fix case-sensitivity

* Fix HARMEAN code logic

* Unit tests refactored into individual files for all logical functions
Implemented IFNA()

* Fix silly typo

* NOT needs ...args to allow for test when no argument passed

* Codestyle

* Use instance asserts
2019-07-26 22:21:17 +02:00
Yigit Cukuren cce6e5976f Calculation :: Added switch function (#983) 2019-05-30 09:14:58 +02:00
Mark Baker 9b44cf3418 Add further new Functions introduced in MS Excel 2013 and 2016 (#608)
- Fix ISFORMULA() function to work with a cell reference to another worksheet
 - Added calculation engine support for the new functions that were added in MS Excel 2013 and MS Excel 2016
   - Text Functions
     - CONCAT()     Synonym for CONCATENATE()
     - NUMBERVALUE()  Converts text to a number, in a locale-independent way
     - UNICHAR()    Synonym for CHAR() in PHPSpreadsheet, which has always used UTF-8 internally
     - UNIORD()     Synonym for ORD() in PHPSpreadsheet, which has always used UTF-8 internally
     - TEXTJOIN()   Joins together two or more text strings, separated by a delimiter
   - Logical Functions
     - XOR()        Returns a logical Exclusive Or of all arguments
   - Date/Time Functions
     - ISOWEEKNUM()  Returns the ISO 8601 week number of the year for a given date
   - Lookup and Reference Functions
     - FORMULATEXT()  Returns a formula as a string
   - Engineering Functions
     - ERF.PRECISE()   Returns the error function integrated between 0 and a supplied limit
     - ERFC.PRECISE()  Synonym for ERFC
   - Math and Trig Functions
     - SEC()          Returns the secant of an angle
     - SECH()         Returns the hyperbolic secant of an angle
     - CSC()          Returns the cosecant of an angle
     - CSCH()         Returns the hyperbolic cosecant of an angle
     - COT()          Returns the cotangent of an angle
     - COTH()         Returns the hyperbolic cotangent of an angle
     - ACOT()         Returns the cotangent of an angle
     - ACOTH()        Returns the hyperbolic cotangent of an angle
  - Financial Functions
    - PDURATION()    Calculates the number of periods required for an investment to reach a specified value
    - RRI()          Calculates the interest rate required for an investment to grow to a specified future value
2018-07-22 19:17:04 +01:00
Adrien Crivelli 8dddf56c2e Use proper syntax for variadic functions
This simplify code, increase readability and improve the function
signature for API users.
2017-01-23 15:01:20 +09:00
Adrien Crivelli e1f81f0fe0 Refactor tests data from custom format to PHP
FIX #14
2016-08-16 21:00:19 +09:00