Commit Graph

99 Commits

Author SHA1 Message Date
Mark Baker 9683e5be18
More unit tests for statistical functions, including a bugfix to LARGE() (#1601)
* More unit tests for statistical functions, including a bugfix to LARGE() that was identified in testing
2020-07-29 23:56:37 +02:00
Mark Baker a9c8470b3b
Identify HYPGEOM.DIST() as a separate Excel function, and additional unit tests (including unhappy path) (#1595) 2020-07-26 22:10:53 +02:00
Mark Baker 8b0aaf7ecf
Named formula implementation, and improved handling of Defined Names generally (#1535)
* Initial work modifying the way named ranges are stored, and handled by the calculation engine
This should provide better support for:
  - both union and intersection operators in composite named range values
  - MS Excel implementation of the union operator duplicating values
  - named formulae
  - named ranges and formulae that reference other named ranges and formulae
  - ranges and formulae that reference multiple ranges across multiple worksheets

* Initial work on handling defined names (named ranges and named formulae) correctly
 - UTF-8 names (already extracted as a separate PR and merged)
 - distinction between named ranges and named formulae
 - correct handling of union and intersection operators in named ranges
 - correct evaluation of named range operators in calculations
 - calculation support for named formulae
 - support for nested ranges and formulae (named ranges and formulae that reference other named ranges/formulae) in calculations

* Minor tweaks before resolving merge conflicts

* Fix extractSheetTitle() method to work on the last ! in a cell reference rather than the first

* Throw exception if a the reference to a defined name in a formula doesn't exist as a defined name

* Properly assess scope for defined names in calculation engine

* Elimination of some redundant code

* Minor tweaks to simplify entries o the stack where we need to check type

* Ensure correct scoping rules are applied when evaluating named ranges and formulae

* Adjustments to Gnumeric Reader for new defined names structure

* Initial work modifying the Ods Reader to handle named ranges, they weren't actually supported previously... this is still ongoing work

* Handle Ranges formatted as 3-d ranges, as long as the references are both to the same worksheet

* Additional testing for Named Ranges formatted as 3-d ranges, as long as the references are both to the same worksheet

* Skip composite named range tests for the moment

* Clean handling for `undefined name` exception when thrown in the calculation engine. Catch and replace with `#NAME?`

* Adjust method we use to determine whether a defined name is a range or a formula

* PHPCS Recommendations

* PHP doesn't support `mixed` yet, at least not at the minium version that we're working with

* More phpcs fixes

* More phpcs appeasements

* Final phpcs fixes for the moment
Still have a lot of echo and var_dump() statements in the code that scrutinizer will hate, but they stay for the moment while this is still WIP

* Please let this be the last of the phpcs fixes

* Unit tests to determine whether a defined name value is a range value or a formula

* phpcs appeasement

* Named tests from provider

* Initial steps for named ranges and formulae in the Ods Reader

* Reading pseudo-3d range addresses in Ods; treat second sheet reference as being identical to the first, which is the majority of cases where this will occur

* Initial work on Gnumeric reader for named ranges and formulae

* Suppress debug logging again

* Remove more debugging displays

* Last minor tweaks before phase two

* Minor refinements

* And all for the want of a space

* A little tidying up

* More tidying up

* phpcs fix

* Modify defined names in rebindParent()

* Renaming variables

* Resolve an issue with locally scoped defined names that don't contain any worksheet reference

* Keep phpcs happy

* Fix quote handling in regexp

* Fix a couple of scrutinizer issues

* Fix a couple of scrutinizer issues

* Update Xlsx Writer to work with the new defined name internal definition
Additional validation checks

* When adding new defined names through the readers, worksheet may not exist if we're only loading selected sheets rather than the full spreadsheet

* If the only thing that phpcs can pickup on is strings in double quotes instead of single quotes, then I know I'm getting close to ready

* Refactor Defined Names logic for Xlsx Writer into its own class

* phpcs keeping me on my toes

* Restore a couple of files that I managed to change without intending to

* Initial work on Ods Write to provide support for saving named ranges and formulae

* Resolve commas to semi-colons s argument separator when writing named formulae for Ods

* Extract Named Expression Writer for Ods into its own class

* Keep phpcs happy

* Refactoring of formula conversion when reading SpreadsheetML; preparation for reading named ranges because they will also need to use the same conversion method

* First pass at reading Named Ranges/Formulae from SpreadsheetML format xml files

* Remove unused namespace reference

* Defined names being written correctly for Xls; but not yet writing cell formulae that reference those defined names... that's the next big step
And I anticipate that defined names that reference other defined names will also be a problem

* Just to keep phpcs happy
... and yes, I know that there are still diagnostic echo statements in the code

* I had to miss some of the phpcs issues didn't I

* Work on the Xls Writer's Parser Tree to identify named range tokens in a formula, and to distinguish them from function tokens

* Still working on packing that d*** defined name reference in the writer

* Throw an exception in the Parser for saving Xls output if we encounter a defined name in a formula... writer will simply write the calculated cell value, and not the formula as at present
Strip out diagnostic output

* Some phpcs appeasement

* Fix a couple of Scrutinizer issues

* Additional verifications to differentiate a formula from a range value
Add explicit getters/setters for named ranges, named formulae and defined names
Additional unit tests

* Styling for closures

* Remove redundant docblocks

* Spaces

* Gah! Namespace use complaints

* Consistency of making calls to DefinedName rather than NamedRange; NamedRange should now be used only for Named Ranges, and should exclude Named Formulae

* Styling

* spurious newline

* No need to test for variable === null when we're typing it in the function argument definition

* Additional unit tests for local/global scoped named ranges and formulae; and a fix to getNamedFormula()

* Fix silly typo that led to breaking test

* Void return signature for unit tests

* Why weren't these picked up in the last pass?

* Refactoring of getNamedRange()/getNamedFormula()

* Eliminate unused constants, and defaults for private method parameters when always called with a value

* Use strict comparisons when comparing object hash codes

* Initial update to documentation for working with named formulae

* Fix for calculation of relative cell references in named ranges/formulae

* Fix current named range tests, because we should be using absolute references; tests for relative named ranges to be added later

* Fix for calculation of relative cell references in named ranges/formulae

* Updates to changelog and documentation for handling of absolute/relative references in named ranges

* Fix last remaining unit test with a named range reference

* Refactor formula conversion for Ods into a separate class; I hadn't realised that it previously wrote formulae as the MS Excel syntax without any conversion to Ods format

* Fix Ods Writer test xml to reflect Ods-native format for formula

* Docblocks

* Drop dollar prefix from Ods formulae and ranges unless it's necessary

* Set the formula convertor in the content writer constructor

* Documentation update

* Minor updates

* Remove var_dumps from file

* Fix the spurious single quote that was breaking named expressions in the Ods Writer... big sigh of relief that I finally spotted it

* Starting work on documentation for Defined Names, and some examples of using Named Ranges and Formulae

* Starting work on documentation for Defined Names, and some examples of using Named Ranges and Formulae

* Example of a relative named range for the documentation

* Mustn't have phpcs problems in sample code either

* More updates to the documentation

* That should conclude the documentation for Named Ranges, now time to move on to documenting Named Formulae

* That should conclude the documentation for Named Ranges, now time to move on to documenting Named Formulae

* PHPCS appeasement in sample code

* Initial documentation on Named Formulae

* PHPCS appeasements

* Additional comments in the documentation, and modify the named range name validation to support a \ as the first character in a name

* Fix breaking build

* Make defined names case-insensitive

* Fix case-insensitivity

* Improved documentation, and additional unit tests

* Additional unit tests, and a fix for removing a globally scoped defined name even if a worksheet is specified in the method call

* Fix unit test for removing named formulae

* Use assertCount instead of assertSame

* Forgotten voids

* Fix arguments for assertCount

* Unit tests for removing defined names, and a fix for removing locally scoped names

* Unit tests for absolute and relative named ranges in calculation engine, and fix an issue with worksheet name in the offset adjustments for relative references

* PHPCS Appeasement

* Additional unit tests, more documentation, and a fix to the calculation engine when no worksheet reference is provided with a named formula

* PHPCS appeasements

* Additional documentation and examples of using Named Formulae

* Additional examples to go with documentation

* A few minor phpcs appeasements

* Minor refactor of updateFormulaReferencesAnyWorksheet() method

* Discard an unused method argument

* Additional unit tests

* Additional unit tests

* Remove unused argument

* Stricter typing

* Fix return typehinting from remove named range/formula; should return the Spreadsheet object

* Use return typehint of self rather than explicit object type

* Redundant code just to keep scrutinizer happy

* Minor change to handle merge conflict

* phpcs fixes after merge

* Namespace usage ordering

* Please let this be the last phpcs fix needed

Co-authored-by: Adrien Crivelli <adrien.crivelli@gmail.com>
2020-07-26 12:00:06 +02:00
Mark Baker fe121e8f7a
Additional statistical unit tests for non-happy path (#1594)
* Additional statistical unit tests for non-happy path
2020-07-25 21:58:08 +02:00
Mark Baker 57213deb64
Implementation of MS Excel's LOGNORM.DIST(), NORM.S.DIST(), F.DIST(), GAUSS() and GAMMA() functions (#1588)
* `GAUSS()` and `GAMMA()`, `NORM.S.DIST()`, `LOGNORM.DIST()` and `F.DIST()` function implementations, and further unit tests for a number of the statistical functions

Co-authored-by: Adrien Crivelli <adrien.crivelli@gmail.com>
2020-07-25 12:44:51 +02:00
Adrien Crivelli 7cb4884b96
WEBSERVICE is HTTP client agnostic
HTTP client must be configured via `Settings::setHttpClient()`. This is
a small breaking change, but only for the very few people who started using
WEBSERVICE from last version.

Fixes #1562
Closes #1568
2020-07-19 11:33:01 +09:00
oleibman 165034ad70
Restoring State After Static Changes in Tests (#1571)
This request does not change any source code, only tests.

For a change on which I was working, a test passed when run on its own,
but failed when run as part of the full test suite. It turned out that
an existing test had changed a static value,
thousands separator in this case, and failed to restore it.
The test turned out to be AdvancedBinderTest.

The search for the offending test was more difficult than it should have
been because 26 test scripts which had nothing to do with thousands
separator nevertheless changed that value. They all changed
decimal separator, currency code, and compatibility mode as well,
again for no reason. I changed all of those to eliminate those operations.

I changed the following tests, which actually do change the static
properties identified above for a reason, to restore them as part of teardown.
- CalculationTest sets compatibilityMode and locale
- DayTest sets compatibilityMode, returnDateType, and excelCalendar
- CountTest sets compatibilityMode
- FunctionsTest sets compatibilityMode and returnDateType
- AdvancedValueBinderTest sets currencyCode, decimalSeparator, thousandsSeparator
- StringHelperTest sets currencyCode, decimalSeparator, thousandsSeparator
- NumberFormatTest sets currencyCode, decimalSeparator, thousandsSeparator
- HtmlNumberFormatTest sets currencyCode, decimalSeparator, thousandsSeparator
2020-07-15 13:23:00 +02:00
paulkned 7f23ccb69d
Added support for the WEBSERVICE function (#1409)
Co-authored-by: Paul Kievits <kievits@rsm.nl>
2020-06-29 10:17:58 +09:00
Mark Baker 10a4a95d67
Handle Ranges formatted as 3-d ranges, as long as the references are both to the same worksheet (#1540) 2020-06-21 14:41:51 +02: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
Mark Baker 12dd92bafe
Resolve utf-8 named ranges in calculation engine (#1522)
* Resolve use of UTF-8 in defined names in the calculation engine
2020-06-13 17:35:29 +02:00
Mark Baker 5c18bb5798
Range operator tests (#1501)
* Improved handling of named ranges, although there are still some issues (names ranges using a union type with an overlap don't handle the overlap twice, which as the MS Excel approach to set overlaps as opposed to the mathematical approach which only applies overlap values once)

* Fix tests that misused space and comma as simple separators in cell ranges
2020-06-02 07:38:35 +02:00
Mark Baker 8b2bba9bdb
Range operator tests (#1498)
* Fix intersection operator when working with named ranges
2020-05-29 21:53:28 +02:00
oleibman 585409a949
Testing - Delete Temp Files When No Longer Needed (#1488)
No code changes. The tests in all of these scripts write to at least
one temporary file, which is then read and not used again. The file
should be deleted to avoid filling up the disk system.
2020-05-24 20:03:07 +09:00
Mark Baker 8ca7bfe53c
Range operator tests (#1487)
* Range Operator Tests
* Correct handling for range intersections that result in an empty array
2020-05-24 00:25:54 +02:00
Mark Baker 86e9d669c6
Range Operator Tests (#1486)
* Range Operator Tests
2020-05-23 22:07:45 +02:00
Adrien Crivelli fcd9f10663
Update PHP-CS-Fixer rules 2020-05-18 13:49:57 +09:00
Owen Leibman 4f6d4af396
Save Excel 2010+ Functions Properly
For functions introduced in Excel 2010 and beyond, Excel saves them
in formulas with the xlfn_ prefix. PhpSpreadsheet does not do this;
as a result, when a spreadsheet so created is opened, the cells
which use the new functions display a #NAME? error.
This the cause of bug report 1246:
https://github.com/PHPOffice/PhpSpreadsheet/issues/1246
This change corrects that problem when the Xlsx writer encounters
a 2010+ formula for a cell or a conditional style. A new class
Writer/Xlsx/Xlfn, with 2 static methods,
is introduced to facilitate this change.

As part of the testing for this, I found some additional problems.
When an unknown function name is used, Excel generates a #NAME? error.
However, when an unknown function is used in PhpSpreadsheet:
  - if there are no parameters, it returns #VALUE!, which is wrong
  - if there are parameters, it throws an exception, which is horrible
Both of these situations will now return #NAME?
Tests have been added for these situations.

The MODE (and MODE.SNGL) function is not quite in alignment with Excel.
MODE(3, 3, 4, 4) returns 3 in both Excel and PhpSpreadsheet.
However, MODE(4, 3, 3, 4) returns 4 in Excel, but 3 in PhpSpreadsheet.
Both situations will now match Excel's result.
Also, Excel allows its parameters for MODE to be an array,
but PhpSpreadsheet did not; it now will.
There had not been any tests for MODE. Now there are.

The SHEET and SHEETS functions were introduced in Excel 2013,
but were not introduced in PhpSpreadsheet. They are now introduced
as DUMMY functions so that they can be parsed appropriately.

Finally, in common with the "rate" changes for which I am
creating a pull request at the same time as this one:
samples/Basic/13_CalculationCyclicFormulae
PhpUnit started reporting an error like "too much regression".
The test deals with an infinite cyclic formula, and allowed
the calculation engine to run for 100 cycles. The actual number of cycles
seems irrelevant for the purpose of this test. I changed it to 15,
and PhpUnit no longer complains.
2020-05-18 12:37:35 +09:00
Adrien Crivelli 414e5695ef
Update CHANGELOG 2020-05-17 19:52:34 +09:00
oleibman 9ae521cdd4
Fix RATE, PRICE, XIRR, and XNPV Functions (#1456)
There were about 20 skipped tests for RATE and PRICE marked
"This test should be fixed". This change does that by fixing
the code for those functions, validating the existing tests,
and adding new ones. XIRR and XNPV are also substantially changed.
As part of this change, the following functions also have minor changes:

  - isValidFrequency
  - COUPDAYBS
  - COUPNUM (additional tests)
  - DB
  - DDB

PhpUnit reports 100% coverage for all the changed functions.

Since I was dealing with skipped tests, I also fixed
tests/PhpSpreadsheetTests/Writer/Xlsx/LocaleFloatsTest,
which was being skipped in Windows. I also delete the temporary
file which it creates.
There is now only one remaining test which is skipped -
ODS Reader is not complete enough to run some tests against it.
Unfortunately, that test is too complicated for me to deal with now.

In researching this change, I found several places in the code where special code was added for Gnumeric claiming:

   - Gnumeric does not handle free-format string dates
   - Gnumeric adds extra options, not available in Excel,
     for the frequency parameter for functions such as YIELD
   - Gnumeric rounds the results for DB and DDB to 2 decimal places

None of these claims is true, at least not on a recent version
of Gnumeric, and the code which supports these differences is removed.
There did not appear to be any tests targeted for
these supposed properties of Gnumeric.

The PRICE function needed relatively minor changes - mostly
additional tests for invalid input. The main problem with the PRICE
tests is that Excel appears to have a bug. The algorithm is published:
https://support.office.com/en-us/article/price-function-3ea9deac-8dfa-436f-a7c8-17ea02c21b0a
The results that Excel returns for basis codes 2 and 3 appear to be
incorrect in many cases. I have segregated these tests into a
new test PRICE3. The results of these tests agree with the published
algorithm, and to the results for LibreOffice and Gnumeric.
The results returned by Excel do not agree with them.
The tests which remain in the test PRICE all use basis codes other
than 2 or 3, and all agree with Excel, LibreOffice, and Gnumeric.

For the RATE function, there appears to be a problem with how the
secant method was implemented. I studied the implementation of RATE
in Python numpy, and adapted its implementation of secant method.
The results now agree with numpy, and, more important, with Excel.

XIRR, which calls XNPV, permits its dates to be earlier than the
start date, whereas XNPV does not. I dealt with this by renaming
the existing XNPV function to xnpvOrdered, adding a parameter to
indicate whether start date has to be earliest. XNPV calls the new
function with that parameter set to TRUE, and XIRR calls it with
the parameter set to FALSE. Some additional error checking was
added to xnpvOrdered, and also to XIRR. XIRR tests benefited
from increasing the value of FINANCIAL_MAX_ITERATIONS.

Finally, since this change is very test-related:
samples/Basic/13_CalculationCyclicFormulae
PhpUnit started reporting an error like "too much regression".
The test deals with an infinite cyclic formula, and allowed
the calculation engine to run for 100 cycles. The actual number of cycles
seems irrelevant for the purpose of this test. I changed it to 15,
and PhpUnit no longer complains.
2020-05-17 19:50:01 +09:00
Adrien Crivelli e868e58d20
Allow to run an entire folder of tests
We now can do something like:

```sh
./vendor/bin/phpunit tests/PhpSpreadsheetTests/Reader/
```
2020-05-17 18:35:55 +09:00
Adrien Crivelli 7e79782dae
Remove @throws comment
Those are extremely hard to maintain properly and bring almost
no value, especially if they are outdated
2020-05-16 20:33:25 +09:00
Adrien Crivelli f1a019e492
Upgrad PHP deps 2020-04-27 19:29:45 +09:00
Paul Kievits a6c56d0f81
Added support for the FLOOR.MATH and FLOOR.PRECISE functions 2020-04-26 22:19:33 +09:00
Owen Leibman c4895b9468
MATCH with a static array should return the position of the found value based on the values submitted.
Returns #N/A, unless the element searched for is at the end of the array.

The problem is in Calculation.php line 4231:
                    if (!is_array($functionCall)) {
                        foreach ($args as &$arg) {
                            $arg = Functions::flattenSingleValue($arg);
                        }
                        unset($arg);
                    }

I believe this code is intended to handle functions where PhpSpreadsheet just passes
the call on to PHP without implementing the code on its own, e.g. for atan or acos.
In the bug report, the following code fails:
  $flat_rate = "=MATCH(6,{4,5,6,2}, 0)";
  $sheet->getCell('A1')->setValue($flat_rate);
The expected value is 3, but the actual result is "#N/A".
The reason for this result is that the parser replaces the braces with calls
to the MKMATRIX internal function, whose value for functioncall was:
'self::MKMATRIX'. Since this isn't an array, the flattening code is executed,
and the unintended result occurs. The fix is to change the definition for
functioncall in that case to [__CLASS__, 'mkMatrix'], avoiding the flattening.

However, there is also another part to this bug. The flattening should be
returning the first entry in the array, but is in fact returning the last.
This explains why the bug report specified "unless ... end of the array".
I confirmed that Excel does use the first item in the array rather than the last,
e.g. =atan({1,2,3}) entered into a cell will return atan(1), not atan(3).
The problem here is that flattenSingleValue, which says in its comments that
it is supposed to be returning the first item, uses array_pop rather than array_shift.
I have changed that as well. The same mistake was also present in
Cell.php function getCalculatedValue. The correct behavior can be verified
by entering =minverse({-2.5,1.5;2,-1}) into an Excel cell'
Excel flattens the result ({2,3;4,5}) to 2, and so should PhpSpreadsheet.

Fixes #1271
Closes #1332
2020-04-26 22:09:31 +09:00
paulkned 0c52f173aa
Added support for the base function (#1344) 2020-02-19 20:12:30 +01:00
paulkned 25e3e45eb6
Added support for the ARABIC excel function (#1343)
Updated changelog

Updated docprops

Fixed stylci
2020-02-11 22:59:19 +01:00
Owen Leibman 9552172b85
Do not confuse defined names and cell refs
CALCULATION_REGEXP_CELLREF is not sufficiently robust.
It treats some perfectly legal defined names, e.g. A1A, as cell refs.
When the Xlsx Writer tries to save a worksheet which uses such a name
in a formula in a cell, it throws an exception.

The new DefinedNameConfusedForCellTest is a simple demonstration.
The Regexp has been changed to ensure the name starts on a Word boundary,
and to make sure it is not followed by a word character or period.
This fixes the problem, and does not appear to cause any regression
problems in the test suite.

Closes #1263
2019-11-30 16:10:43 +01:00
Adrien Crivelli 9fa45f7e48
PHP 7.4 compatibility 2019-11-30 00:12:46 +01:00
Paul Blacknell 788f79c1bb
Validate XIRR inputs and return correct error values
Fix: Return #NUM! if values and dates contain a different number of values
Fix: Return #NUM! if there is not at least one positive cash flow and one negative cash flow
Fix: Return #NUM! if any number in dates precedes the starting date
Fix: Return #NUM! if a result that works cannot be found after max iteration tries
Fix: Correct DocBlocks for XIRR & XNPV
Add: Validate XIRR with unit tests

Closes #1177
2019-11-17 21:17:12 +01:00
Adrien Crivelli 99d4f185fb
Avoid test without assertion 2019-11-10 17:05:18 +01:00
Adrien Crivelli ee5134a954
Merge branch 'master' into Further-Test-Refactoring 2019-09-20 16:04:36 -07:00
yunjusu bbbfdb86a0
Fix `getCalculatedValue()` error with more than two INDIRECT
Closes #1115
2019-08-17 12:59:30 -07:00
Fräntz Miccoli 0b387e767e
Branch pruning around IF function calls to avoid resolution of every branches
Calculation engine was resolving every function by first resolving its arguments
including IFs, this was causing significant over evaluation when IFs were used
as it meant for every case to be evaluated.

Introduce elements to identify ifs and enable better branch resolution
(pruning). We tag parsed tokens to associate a branch identifier to them.

Closes #844
2019-08-11 18:23:47 -07:00
MarkBaker f14e5ea837 More refactoring Excel of Calculation Function Unit Tests 2019-07-27 16:35:27 +02:00
MarkBaker 905a697639 More work on refactoring Excel Calculation Function Unit Tests 2019-07-27 16:02:58 +02:00
Mark Baker 26e87c45ae
Test refactoring (#1112)
* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* Argument fix

* Text Test functions refactored into individual test files

* Codestyle (line at eof)

* docblocks
2019-07-27 14:28:16 +02: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
Mark Baker aaf996a165
Refactor engineering tests (#1106)
* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* Bessels, and set some date tests to defined/named arguments

* Fix test class naming

* Names arguments for math/trig tests

* Docblock updates

* More engineering function unit test refactorings

* More engineering function unit test refactorings. This time, moving on to the Complex engineering functions

* Fix ImConjugate test

* Fix parseComplex test

* Fix parseComplex test

* More of the complex number function unit tests refactored

* Finish refactoring of the complex number function unit tests

* Newer phpunit assertions

* Add parsecomplex unit test back until we're ready to drop the deprecated function; but as it doesn't use the specified data provider at all, drop reference to that
2019-07-25 21:02:41 +02:00
Adrien Crivelli fa54ca79a3
Migrate away from deprecated PHPUnit asserts 2019-07-25 10:15:53 -07:00
Adrien Crivelli b2070fd181
Upgrade to phpunit 7.5 2019-07-24 23:45:43 -07:00
Mark Baker 342ffb629b
Refactoring of math trig tests (#1102)
* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* First pass at moving MathTrig tests into individual test files

* Appeasement to the great goddess PHPCS

* Appeasement to the great goddess PHPCS

* Minor scrutinizer issue resolved

* More refactoring of tests into individual test files fr each math/trig function

* More work on the math/trig test refactoring, plus a bit of tidyup of date/time tests as well

* Fix test

* Fix docblock in test

* Finish refactoring Math/Trig tests into separate files

* Fix SubTotal Test

* Import additional classes for SubTotal test
2019-07-23 00:50:30 +02:00
Mark Baker 9ad6de620e
Refactoring of date time tests (#1101)
* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* Separate out date/time tests into individual tests

* Need to update the version of phpunit at some point to deal with the new assertions and deprecated assertions

* Appease the CS Gods

* More refactoring of Date/Time tests

* Replace self assertions with instance assertions (looking forward to upgrading phpunit)

* Finish refactoring of date/time tests as individual tests

* Test for DateTimeInterface rather than for DateTime

* A few strict comparisons

* Fix to test names
2019-07-21 20:55:41 +02:00
Mark Baker 554684720d
Statistical issues (#1098)
* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* Adjusted logic for COUNT() function to handle differences in EXCEL, GNUMERIC and OPENOFFICE modes for cells and for literal values

* Fix case-sensitivity in filenames

* Appeasing Codesniffer

* Resolve COUNTA() differences between cell values and literals

* Style fixes

* Start refactoring statistical function tests into individual tests rather than having a single, giant test for all statistical functions.... first step toward doing this for all tests

* More refactoring into separate tests
If all functions have their own individual test files, it should be a lot easier to identify which functions aren't covered by tests yet

* Missing last lines in files
2019-07-20 18:40:05 +02:00
Mark Baker a367f35438
Trend function unit tests (#1089)
* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* More trend function unit tests

* Yet more trend function unit tests
2019-07-16 23:51:48 +02:00
Mark Baker 6d739f1fe6
Additional statistical work (#1088)
* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* More statistical tests

* Further statistical tests

* Unit tests for some of the trend functions

* resolve scrutiniser objections

* Fix order of @return types :-(
2019-07-16 20:35:48 +02:00
Mark Baker f1e82a212f
Extended unit tests (#1087)
* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* Additional unit tests for average functions, and fix to AVERAGEIF() function if third argument is passed

* Update change log

* Stricter typed comparisons in AVERAGEIF() conditions

* Unit tests for BETADIST() and BETAINV()
2019-07-16 16:18:42 +02:00
Mark Baker a91acec5d9
Countif strict comparison (#1078)
* Stricter-typed comparison testing in COUNTIF() and COUNTIFS() evaluation [Issue #1046](https://github.com/PHPOffice/PhpSpreadsheet/issues/1046)

* Codestyle

* Codestyle

* Codestyle in tests
2019-07-14 16:22:31 +02:00
Zdeněk Drahoš 42fc71f314 Calculation/Statistical :: Add MAXIFS, MINIFS, COUNTIFS and Remove MINIF, MAXIF (#1059)
* #1056 - replace invalid minif/maxif functions by not implemented minifs/maxifs

minif/maxif is not support in Excel, Google Spreadsheets, Libreoffice
https://support.office.com/en-us/article/excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188#bm13

* #1056 - implement minifs/maxifs

Copy-pasted sumifs...
https://github.com/PHPOffice/PhpSpreadsheet/blob/1.8.1/src/PhpSpreadsheet/Calculation/MathTrig.php#L1254

* #1056 - implement countifs

* #1056 - fix code style

composer check
composer fix

* #1056 - update changelog
2019-07-14 12:55:42 +02:00
Mark Baker 0ea97f14e1
Fixes to coupon functions (#1068)
* New Unit Tests for COUPNUM()

* COUPNUM should not return zero when settlement is in the last period

* Additional tests and fixes for COUPNCD() and COUPPCD() functions
2019-07-10 21:22:16 +02:00