diff --git a/src/PhpSpreadsheet/Calculation/Engineering.php b/src/PhpSpreadsheet/Calculation/Engineering.php index d70b32d6a..c35be9b68 100644 --- a/src/PhpSpreadsheet/Calculation/Engineering.php +++ b/src/PhpSpreadsheet/Calculation/Engineering.php @@ -15,7 +15,8 @@ class Engineering * EULER. * * @deprecated 1.18.0 - * @see Use Engineering\Constants\EULER instead + * Use Engineering\Constants::EULER instead + * @see Engineering\Constants::EULER */ public const EULER = 2.71828182845904523536; @@ -50,9 +51,9 @@ class Engineering * Excel Function: * BESSELI(x,ord) * - * @Deprecated 1.17.0 - * - * @see Use the BESSELI() method in the Engineering\BesselI class instead + * @deprecated 1.17.0 + * Use the BESSELI() method in the Engineering\BesselI class instead + * @see Engineering\BesselI::BESSELI() * * @param float $x The value at which to evaluate the function. * If x is nonnumeric, BESSELI returns the #VALUE! error value. @@ -76,9 +77,9 @@ class Engineering * Excel Function: * BESSELJ(x,ord) * - * @Deprecated 1.17.0 - * - * @see Use the BESSELJ() method in the Engineering\BesselJ class instead + * @deprecated 1.17.0 + * Use the BESSELJ() method in the Engineering\BesselJ class instead + * @see Engineering\BesselJ::BESSELJ() * * @param float $x The value at which to evaluate the function. * If x is nonnumeric, BESSELJ returns the #VALUE! error value. @@ -102,9 +103,9 @@ class Engineering * Excel Function: * BESSELK(x,ord) * - * @Deprecated 1.17.0 - * - * @see Use the BESSELK() method in the Engineering\BesselK class instead + * @deprecated 1.17.0 + * Use the BESSELK() method in the Engineering\BesselK class instead + * @see Engineering\BesselK::BESSELK() * * @param float $x The value at which to evaluate the function. * If x is nonnumeric, BESSELK returns the #VALUE! error value. @@ -127,9 +128,9 @@ class Engineering * Excel Function: * BESSELY(x,ord) * - * @Deprecated 1.17.0 - * - * @see Use the BESSELY() method in the Engineering\BesselY class instead + * @deprecated 1.17.0 + * Use the BESSELY() method in the Engineering\BesselY class instead + * @see Engineering\BesselY::BESSELY() * * @param float $x The value at which to evaluate the function. * If x is nonnumeric, BESSELY returns the #VALUE! error value. @@ -152,9 +153,9 @@ class Engineering * Excel Function: * BIN2DEC(x) * - * @Deprecated 1.17.0 - * - * @see Use the toDecimal() method in the Engineering\ConvertBinary class instead + * @deprecated 1.17.0 + * Use the toDecimal() method in the Engineering\ConvertBinary class instead + * @see Engineering\ConvertBinary::toDecimal() * * @param mixed $x The binary number (as a string) that you want to convert. The number * cannot contain more than 10 characters (10 bits). The most significant @@ -178,9 +179,9 @@ class Engineering * Excel Function: * BIN2HEX(x[,places]) * - * @Deprecated 1.17.0 - * - * @see Use the toHex() method in the Engineering\ConvertBinary class instead + * @deprecated 1.17.0 + * Use the toHex() method in the Engineering\ConvertBinary class instead + * @see Engineering\ConvertBinary::toHex() * * @param mixed $x The binary number (as a string) that you want to convert. The number * cannot contain more than 10 characters (10 bits). The most significant @@ -210,9 +211,9 @@ class Engineering * Excel Function: * BIN2OCT(x[,places]) * - * @Deprecated 1.17.0 - * - * @see Use the toOctal() method in the Engineering\ConvertBinary class instead + * @deprecated 1.17.0 + * Use the toOctal() method in the Engineering\ConvertBinary class instead + * @see Engineering\ConvertBinary::toOctal() * * @param mixed $x The binary number (as a string) that you want to convert. The number * cannot contain more than 10 characters (10 bits). The most significant @@ -242,9 +243,9 @@ class Engineering * Excel Function: * DEC2BIN(x[,places]) * - * @Deprecated 1.17.0 - * - * @see Use the toBinary() method in the Engineering\ConvertDecimal class instead + * @deprecated 1.17.0 + * Use the toBinary() method in the Engineering\ConvertDecimal class instead + * @see Engineering\ConvertDecimal::toBinary() * * @param mixed $x The decimal integer you want to convert. If number is negative, * valid place values are ignored and DEC2BIN returns a 10-character @@ -278,9 +279,9 @@ class Engineering * Excel Function: * DEC2HEX(x[,places]) * - * @Deprecated 1.17.0 - * - * @see Use the toHex() method in the Engineering\ConvertDecimal class instead + * @deprecated 1.17.0 + * Use the toHex() method in the Engineering\ConvertDecimal class instead + * @see Engineering\ConvertDecimal::toHex() * * @param mixed $x The decimal integer you want to convert. If number is negative, * places is ignored and DEC2HEX returns a 10-character (40-bit) @@ -314,9 +315,9 @@ class Engineering * Excel Function: * DEC2OCT(x[,places]) * - * @Deprecated 1.17.0 - * - * @see Use the toOctal() method in the Engineering\ConvertDecimal class instead + * @deprecated 1.17.0 + * Use the toOctal() method in the Engineering\ConvertDecimal class instead + * @see Engineering\ConvertDecimal::toOctal() * * @param mixed $x The decimal integer you want to convert. If number is negative, * places is ignored and DEC2OCT returns a 10-character (30-bit) @@ -350,9 +351,9 @@ class Engineering * Excel Function: * HEX2BIN(x[,places]) * - * @Deprecated 1.17.0 - * - * @see Use the toBinary() method in the Engineering\ConvertHex class instead + * @deprecated 1.17.0 + * Use the toBinary() method in the Engineering\ConvertHex class instead + * @see Engineering\ConvertHex::toBinary() * * @param mixed $x the hexadecimal number (as a string) that you want to convert. * Number cannot contain more than 10 characters. @@ -386,9 +387,9 @@ class Engineering * Excel Function: * HEX2DEC(x) * - * @Deprecated 1.17.0 - * - * @see Use the toDecimal() method in the Engineering\ConvertHex class instead + * @deprecated 1.17.0 + * Use the toDecimal() method in the Engineering\ConvertHex class instead + * @see Engineering\ConvertHex::toDecimal() * * @param mixed $x The hexadecimal number (as a string) that you want to convert. This number cannot * contain more than 10 characters (40 bits). The most significant @@ -413,9 +414,9 @@ class Engineering * Excel Function: * HEX2OCT(x[,places]) * - * @Deprecated 1.17.0 - * - * @see Use the toOctal() method in the Engineering\ConvertHex class instead + * @deprecated 1.17.0 + * Use the toOctal() method in the Engineering\ConvertHex class instead + * @see Engineering\ConvertHex::toOctal() * * @param mixed $x The hexadecimal number (as a string) that you want to convert. Number cannot * contain more than 10 characters. The most significant bit of @@ -453,9 +454,9 @@ class Engineering * Excel Function: * OCT2BIN(x[,places]) * - * @Deprecated 1.17.0 - * - * @see Use the toBinary() method in the Engineering\ConvertOctal class instead + * @deprecated 1.17.0 + * Use the toBinary() method in the Engineering\ConvertOctal class instead + * @see Engineering\ConvertOctal::toBinary() * * @param mixed $x The octal number you want to convert. Number may not * contain more than 10 characters. The most significant @@ -495,9 +496,9 @@ class Engineering * Excel Function: * OCT2DEC(x) * - * @Deprecated 1.17.0 - * - * @see Use the toDecimal() method in the Engineering\ConvertOctal class instead + * @deprecated 1.17.0 + * Use the toDecimal() method in the Engineering\ConvertOctal class instead + * @see Engineering\ConvertOctal::toDecimal() * * @param mixed $x The octal number you want to convert. Number may not contain * more than 10 octal characters (30 bits). The most significant @@ -522,9 +523,9 @@ class Engineering * Excel Function: * OCT2HEX(x[,places]) * - * @Deprecated 1.17.0 - * - * @see Use the toHex() method in the Engineering\ConvertOctal class instead + * @deprecated 1.17.0 + * Use the toHex() method in the Engineering\ConvertOctal class instead + * @see Engineering\ConvertOctal::toHex() * * @param mixed $x The octal number you want to convert. Number may not contain * more than 10 octal characters (30 bits). The most significant @@ -559,9 +560,9 @@ class Engineering * Excel Function: * COMPLEX(realNumber,imaginary[,suffix]) * - * @Deprecated 1.18.0 - * - * @see Use the COMPLEX() method in the Engineering\Complex class instead + * @deprecated 1.18.0 + * Use the COMPLEX() method in the Engineering\Complex class instead + * @see Engineering\Complex::COMPLEX() * * @param array|float $realNumber the real coefficient of the complex number * @param array|float $imaginary the imaginary coefficient of the complex number @@ -583,9 +584,9 @@ class Engineering * Excel Function: * IMAGINARY(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMAGINARY() method in the Engineering\Complex class instead + * @deprecated 1.18.0 + * Use the IMAGINARY() method in the Engineering\Complex class instead + * @see Engineering\Complex::IMAGINARY() * * @param string $complexNumber the complex number for which you want the imaginary * coefficient @@ -605,9 +606,9 @@ class Engineering * Excel Function: * IMREAL(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMREAL() method in the Engineering\Complex class instead + * @deprecated 1.18.0 + * Use the IMREAL() method in the Engineering\Complex class instead + * @see Engineering\Complex::IMREAL() * * @param string $complexNumber the complex number for which you want the real coefficient * @@ -626,9 +627,9 @@ class Engineering * Excel Function: * IMABS(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMABS() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMABS() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMABS() * * @param string $complexNumber the complex number for which you want the absolute value * @@ -648,9 +649,9 @@ class Engineering * Excel Function: * IMARGUMENT(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMARGUMENT() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMARGUMENT() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMARGUMENT() * * @param array|string $complexNumber the complex number for which you want the argument theta * @@ -669,9 +670,9 @@ class Engineering * Excel Function: * IMCONJUGATE(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMARGUMENT() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMCONJUGATE() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMCONJUGATE() * * @param array|string $complexNumber the complex number for which you want the conjugate * @@ -690,9 +691,9 @@ class Engineering * Excel Function: * IMCOS(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMCOS() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMCOS() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMCOS() * * @param array|string $complexNumber the complex number for which you want the cosine * @@ -711,9 +712,9 @@ class Engineering * Excel Function: * IMCOSH(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMCOSH() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMCOSH() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMCOSH() * * @param array|string $complexNumber the complex number for which you want the hyperbolic cosine * @@ -732,9 +733,9 @@ class Engineering * Excel Function: * IMCOT(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMCOT() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMCOT() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMCOT() * * @param array|string $complexNumber the complex number for which you want the cotangent * @@ -753,9 +754,9 @@ class Engineering * Excel Function: * IMCSC(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMCSC() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMCSC() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMCSC() * * @param array|string $complexNumber the complex number for which you want the cosecant * @@ -774,9 +775,9 @@ class Engineering * Excel Function: * IMCSCH(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMCSCH() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMCSCH() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMCSCH() * * @param array|string $complexNumber the complex number for which you want the hyperbolic cosecant * @@ -795,9 +796,9 @@ class Engineering * Excel Function: * IMSIN(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMSIN() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMSIN() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMSIN() * * @param string $complexNumber the complex number for which you want the sine * @@ -816,9 +817,9 @@ class Engineering * Excel Function: * IMSINH(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMSINH() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMSINH() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMSINH() * * @param string $complexNumber the complex number for which you want the hyperbolic sine * @@ -837,9 +838,9 @@ class Engineering * Excel Function: * IMSEC(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMSEC() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMSEC() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMSEC() * * @param string $complexNumber the complex number for which you want the secant * @@ -858,9 +859,9 @@ class Engineering * Excel Function: * IMSECH(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMSECH() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMSECH() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMSECH($complexNumber) * * @param string $complexNumber the complex number for which you want the hyperbolic secant * @@ -879,9 +880,9 @@ class Engineering * Excel Function: * IMTAN(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMTAN() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMTAN() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMTAN() * * @param string $complexNumber the complex number for which you want the tangent * @@ -900,9 +901,9 @@ class Engineering * Excel Function: * IMSQRT(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMSQRT() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMSQRT() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMSQRT() * * @param string $complexNumber the complex number for which you want the square root * @@ -921,9 +922,9 @@ class Engineering * Excel Function: * IMLN(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMLN() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMLN() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMLN() * * @param string $complexNumber the complex number for which you want the natural logarithm * @@ -942,9 +943,9 @@ class Engineering * Excel Function: * IMLOG10(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMLOG10() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMLOG10() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMLOG10() * * @param string $complexNumber the complex number for which you want the common logarithm * @@ -963,9 +964,9 @@ class Engineering * Excel Function: * IMLOG2(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMLOG2() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMLOG2() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMLOG2() * * @param string $complexNumber the complex number for which you want the base-2 logarithm * @@ -984,9 +985,9 @@ class Engineering * Excel Function: * IMEXP(complexNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMEXP() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMEXP() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMEXP() * * @param string $complexNumber the complex number for which you want the exponential * @@ -1005,9 +1006,9 @@ class Engineering * Excel Function: * IMPOWER(complexNumber,realNumber) * - * @Deprecated 1.18.0 - * - * @see Use the IMPOWER() method in the Engineering\ComplexFunctions class instead + * @deprecated 1.18.0 + * Use the IMPOWER() method in the Engineering\ComplexFunctions class instead + * @see ComplexFunctions::IMPOWER() * * @param string $complexNumber the complex number you want to raise to a power * @param float $realNumber the power to which you want to raise the complex number @@ -1027,9 +1028,9 @@ class Engineering * Excel Function: * IMDIV(complexDividend,complexDivisor) * - * @Deprecated 1.18.0 - * - * @see Use the IMDIV() method in the Engineering\ComplexOperations class instead + * @deprecated 1.18.0 + * Use the IMDIV() method in the Engineering\ComplexOperations class instead + * @see ComplexOperations::IMDIV() * * @param string $complexDividend the complex numerator or dividend * @param string $complexDivisor the complex denominator or divisor @@ -1049,9 +1050,9 @@ class Engineering * Excel Function: * IMSUB(complexNumber1,complexNumber2) * - * @Deprecated 1.18.0 - * - * @see Use the IMSUB() method in the Engineering\ComplexOperations class instead + * @deprecated 1.18.0 + * Use the IMSUB() method in the Engineering\ComplexOperations class instead + * @see ComplexOperations::IMSUB() * * @param string $complexNumber1 the complex number from which to subtract complexNumber2 * @param string $complexNumber2 the complex number to subtract from complexNumber1 @@ -1071,9 +1072,9 @@ class Engineering * Excel Function: * IMSUM(complexNumber[,complexNumber[,...]]) * - * @Deprecated 1.18.0 - * - * @see Use the IMSUM() method in the Engineering\ComplexOperations class instead + * @deprecated 1.18.0 + * Use the IMSUM() method in the Engineering\ComplexOperations class instead + * @see ComplexOperations::IMSUM() * * @param string ...$complexNumbers Series of complex numbers to add * @@ -1092,9 +1093,9 @@ class Engineering * Excel Function: * IMPRODUCT(complexNumber[,complexNumber[,...]]) * - * @Deprecated 1.18.0 - * - * @see Use the IMPRODUCT() method in the Engineering\ComplexOperations class instead + * @deprecated 1.18.0 + * Use the IMPRODUCT() method in the Engineering\ComplexOperations class instead + * @see ComplexOperations::IMPRODUCT() * * @param string ...$complexNumbers Series of complex numbers to multiply * @@ -1116,9 +1117,9 @@ class Engineering * Excel Function: * DELTA(a[,b]) * - * @Deprecated 1.17.0 - * - * @see Use the DELTA() method in the Engineering\Compare class instead + * @deprecated 1.17.0 + * Use the DELTA() method in the Engineering\Compare class instead + * @see Engineering\Compare::DELTA($a, $b) * * @param float $a the first number * @param float $b The second number. If omitted, b is assumed to be zero. @@ -1140,9 +1141,9 @@ class Engineering * Use this function to filter a set of values. For example, by summing several GESTEP * functions you calculate the count of values that exceed a threshold. * - * @Deprecated 1.17.0 - * - * @see Use the GESTEP() method in the Engineering\Compare class instead + * @deprecated 1.17.0 + * Use the GESTEP() method in the Engineering\Compare class instead + * @see Engineering\Compare::GESTEP() * * @param float $number the value to test against step * @param float $step The threshold value. If you omit a value for step, GESTEP uses zero. @@ -1162,9 +1163,9 @@ class Engineering * Excel Function: * BITAND(number1, number2) * - * @Deprecated 1.17.0 - * - * @see Use the BITAND() method in the Engineering\BitWise class instead + * @deprecated 1.17.0 + * Use the BITAND() method in the Engineering\BitWise class instead + * @see Engineering\BitWise::BITAND() * * @param int $number1 * @param int $number2 @@ -1184,9 +1185,9 @@ class Engineering * Excel Function: * BITOR(number1, number2) * - * @Deprecated 1.17.0 - * - * @see Use the BITOR() method in the Engineering\BitWise class instead + * @deprecated 1.17.0 + * Use the BITOR() method in the Engineering\BitWise class instead + * @see Engineering\BitWise::BITOR() * * @param int $number1 * @param int $number2 @@ -1206,9 +1207,9 @@ class Engineering * Excel Function: * BITXOR(number1, number2) * - * @Deprecated 1.17.0 - * - * @see Use the BITXOR() method in the Engineering\BitWise class instead + * @deprecated 1.17.0 + * Use the BITXOR() method in the Engineering\BitWise class instead + * @see Engineering\BitWise::BITXOR() * * @param int $number1 * @param int $number2 @@ -1228,9 +1229,9 @@ class Engineering * Excel Function: * BITLSHIFT(number, shift_amount) * - * @Deprecated 1.17.0 - * - * @see Use the BITLSHIFT() method in the Engineering\BitWise class instead + * @deprecated 1.17.0 + * Use the BITLSHIFT() method in the Engineering\BitWise class instead + * @see Engineering\BitWise::BITLSHIFT() * * @param int $number * @param int $shiftAmount @@ -1250,9 +1251,9 @@ class Engineering * Excel Function: * BITRSHIFT(number, shift_amount) * - * @Deprecated 1.17.0 - * - * @see Use the BITRSHIFT() method in the Engineering\BitWise class instead + * @deprecated 1.17.0 + * Use the BITRSHIFT() method in the Engineering\BitWise class instead + * @see Engineering\BitWise::BITRSHIFT() * * @param int $number * @param int $shiftAmount @@ -1277,9 +1278,9 @@ class Engineering * Excel Function: * ERF(lower[,upper]) * - * @Deprecated 1.17.0 - * - * @see Use the ERF() method in the Engineering\Erf class instead + * @deprecated 1.17.0 + * Use the ERF() method in the Engineering\Erf class instead + * @see Engineering\Erf::ERF() * * @param float $lower lower bound for integrating ERF * @param float $upper upper bound for integrating ERF. @@ -1300,9 +1301,9 @@ class Engineering * Excel Function: * ERF.PRECISE(limit) * - * @Deprecated 1.17.0 - * - * @see Use the ERFPRECISE() method in the Engineering\Erf class instead + * @deprecated 1.17.0 + * Use the ERFPRECISE() method in the Engineering\Erf class instead + * @see Engineering\Erf::ERFPRECISE() * * @param float $limit bound for integrating ERF * @@ -1326,9 +1327,9 @@ class Engineering * Excel Function: * ERFC(x) * - * @Deprecated 1.17.0 - * - * @see Use the ERFC() method in the Engineering\ErfC class instead + * @deprecated 1.17.0 + * Use the ERFC() method in the Engineering\ErfC class instead + * @see Engineering\ErfC::ERFC() * * @param float $x The lower bound for integrating ERFC * @@ -1343,9 +1344,9 @@ class Engineering * getConversionGroups * Returns a list of the different conversion groups for UOM conversions. * - * @Deprecated 1.16.0 - * - * @see Use the getConversionCategories() method in the Engineering\ConvertUOM class instead + * @deprecated 1.16.0 + * Use the getConversionCategories() method in the Engineering\ConvertUOM class instead + * @see Engineering\ConvertUOM::getConversionCategories() * * @return array */ @@ -1358,9 +1359,9 @@ class Engineering * getConversionGroupUnits * Returns an array of units of measure, for a specified conversion group, or for all groups. * - * @Deprecated 1.16.0 - * - * @see Use the getConversionCategoryUnits() method in the ConvertUOM class instead + * @deprecated 1.16.0 + * Use the getConversionCategoryUnits() method in the ConvertUOM class instead + * @see Engineering\ConvertUOM::getConversionCategoryUnits() * * @param null|mixed $category * @@ -1374,9 +1375,9 @@ class Engineering /** * getConversionGroupUnitDetails. * - * @Deprecated 1.16.0 - * - * @see Use the getConversionCategoryUnitDetails() method in the ConvertUOM class instead + * @deprecated 1.16.0 + * Use the getConversionCategoryUnitDetails() method in the ConvertUOM class instead + * @see Engineering\ConvertUOM::getConversionCategoryUnitDetails() * * @param null|mixed $category * @@ -1391,9 +1392,9 @@ class Engineering * getConversionMultipliers * Returns an array of the Multiplier prefixes that can be used with Units of Measure in CONVERTUOM(). * - * @Deprecated 1.16.0 - * - * @see Use the getConversionMultipliers() method in the ConvertUOM class instead + * @deprecated 1.16.0 + * Use the getConversionMultipliers() method in the ConvertUOM class instead + * @see Engineering\ConvertUOM::getConversionMultipliers() * * @return mixed[] */ @@ -1408,9 +1409,9 @@ class Engineering * Returns an array of the additional Multiplier prefixes that can be used with Information Units of Measure * in CONVERTUOM(). * - * @Deprecated 1.16.0 - * - * @see Use the getBinaryConversionMultipliers() method in the ConvertUOM class instead + * @deprecated 1.16.0 + * Use the getBinaryConversionMultipliers() method in the ConvertUOM class instead + * @see Engineering\ConvertUOM::getBinaryConversionMultipliers() * * @return mixed[] */ @@ -1429,9 +1430,9 @@ class Engineering * Excel Function: * CONVERT(value,fromUOM,toUOM) * - * @Deprecated 1.16.0 - * - * @see Use the CONVERT() method in the ConvertUOM class instead + * @deprecated 1.16.0 + * Use the CONVERT() method in the ConvertUOM class instead + * @see Engineering\ConvertUOM::CONVERT() * * @param float|int $value the value in fromUOM to convert * @param string $fromUOM the units for value diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/AllSetupTeardown.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/AllSetupTeardown.php new file mode 100644 index 000000000..c001c4a8c --- /dev/null +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/AllSetupTeardown.php @@ -0,0 +1,149 @@ +compatibilityMode = Functions::getCompatibilityMode(); + } + + protected function tearDown(): void + { + Functions::setCompatibilityMode($this->compatibilityMode); + $this->sheet = null; + if ($this->spreadsheet !== null) { + $this->spreadsheet->disconnectWorksheets(); + $this->spreadsheet = null; + } + } + + protected static function setOpenOffice(): void + { + Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE); + } + + protected static function setGnumeric(): void + { + Functions::setCompatibilityMode(Functions::COMPATIBILITY_GNUMERIC); + } + + /** + * @param mixed $expectedResult + */ + protected function mightHaveException($expectedResult): void + { + if ($expectedResult === 'exception') { + $this->expectException(CalcException::class); + } + } + + /** + * @param mixed $value + */ + protected function setCell(string $cell, $value): void + { + if ($value !== null) { + if (is_string($value) && is_numeric($value)) { + $this->getSheet()->getCell($cell)->setValueExplicit($value, DataType::TYPE_STRING); + } else { + $this->getSheet()->getCell($cell)->setValue($value); + } + } + } + + protected function getSpreadsheet(): Spreadsheet + { + if ($this->spreadsheet !== null) { + return $this->spreadsheet; + } + $this->spreadsheet = new Spreadsheet(); + + return $this->spreadsheet; + } + + protected function getSheet(): Worksheet + { + if ($this->sheet !== null) { + return $this->sheet; + } + $this->sheet = $this->getSpreadsheet()->getActiveSheet(); + + return $this->sheet; + } + + /** + * @param mixed $expectedResult + * @param array $args + */ + protected function runTestCase(string $functionName, $expectedResult, ...$args): void + { + $this->mightHaveException($expectedResult); + $sheet = $this->getSheet(); + $formula = "=$functionName("; + $comma = ''; + $row = 0; + foreach ($args as $arg) { + ++$row; + $cellId = "A$row"; + $formula .= "$comma$cellId"; + $comma = ','; + $this->setCell($cellId, $arg); + } + $formula .= ')'; + $this->setCell('B1', $formula); + self::assertEqualsWithDelta($expectedResult, $sheet->getCell('B1')->getCalculatedValue(), 1.0e-8); + } + + /** + * @param mixed $expectedResult + * @param array $args + */ + protected function runComplexTestCase(string $functionName, $expectedResult, ...$args): void + { + $complexAssert = new ComplexAssert(); + $this->mightHaveException($expectedResult); + $sheet = $this->getSheet(); + $formula = "=$functionName("; + $comma = ''; + $row = 0; + foreach ($args as $arg) { + ++$row; + $cellId = "A$row"; + $formula .= "$comma$cellId"; + $comma = ','; + $this->setCell($cellId, $arg); + } + $formula .= ')'; + $this->setCell('B1', $formula); + $result = $sheet->getCell('B1')->getCalculatedValue(); + self::assertTrue( + $complexAssert->assertComplexEquals($expectedResult, $result, 1.0e-8), + $complexAssert->getErrorMessage() + ); + } +} diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselITest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselITest.php index 6e9673a88..99b243b00 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselITest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselITest.php @@ -3,19 +3,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PHPUnit\Framework\TestCase; -class BesselITest extends TestCase +class BesselITest extends AllSetupTeardown { - const BESSEL_PRECISION = 1E-9; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - } - /** * @dataProvider providerBESSELI * @@ -23,8 +13,7 @@ class BesselITest extends TestCase */ public function testBESSELI($expectedResult, ...$args): void { - $result = Engineering::BESSELI(...$args); - self::assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); + $this->runTestCase('BESSELI', $expectedResult, ...$args); } public function providerBESSELI(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselJTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselJTest.php index 16002ae5d..b907fc128 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselJTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselJTest.php @@ -3,19 +3,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PHPUnit\Framework\TestCase; -class BesselJTest extends TestCase +class BesselJTest extends AllSetupTeardown { - const BESSEL_PRECISION = 1E-8; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - } - /** * @dataProvider providerBESSEJ * @@ -23,8 +13,7 @@ class BesselJTest extends TestCase */ public function testBESSELJ($expectedResult, ...$args): void { - $result = Engineering::BESSELJ(...$args); - self::assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); + $this->runTestCase('BESSELJ', $expectedResult, ...$args); } public function providerBESSEJ(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselKTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselKTest.php index 11e0885e2..11f8a045d 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselKTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselKTest.php @@ -3,19 +3,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PHPUnit\Framework\TestCase; -class BesselKTest extends TestCase +class BesselKTest extends AllSetupTeardown { - const BESSEL_PRECISION = 1E-12; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - } - /** * @dataProvider providerBESSELK * @@ -23,8 +13,7 @@ class BesselKTest extends TestCase */ public function testBESSELK($expectedResult, ...$args): void { - $result = Engineering::BESSELK(...$args); - self::assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); + $this->runTestCase('BESSELK', $expectedResult, ...$args); } public function providerBESSELK(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselYTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselYTest.php index 47f05e986..04adc5dad 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselYTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BesselYTest.php @@ -3,19 +3,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PHPUnit\Framework\TestCase; -class BesselYTest extends TestCase +class BesselYTest extends AllSetupTeardown { - const BESSEL_PRECISION = 1E-12; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - } - /** * @dataProvider providerBESSELY * @@ -23,8 +13,7 @@ class BesselYTest extends TestCase */ public function testBESSELY($expectedResult, ...$args): void { - $result = Engineering::BESSELY(...$args); - self::assertEqualsWithDelta($expectedResult, $result, self::BESSEL_PRECISION); + $this->runTestCase('BESSELY', $expectedResult, ...$args); } public function providerBESSELY(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2DecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2DecTest.php index beb31bbb4..4531e958f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2DecTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2DecTest.php @@ -42,6 +42,7 @@ class Bin2DecTest extends TestCase $sheet->getCell('A1')->setValue("=BIN2DEC($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerBIN2DEC(): array @@ -72,6 +73,7 @@ class Bin2DecTest extends TestCase $sheet->getCell('A1')->setValue("=BIN2DEC($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testBIN2DECFrac(): void @@ -90,6 +92,7 @@ class Bin2DecTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=BIN2DEC(101.1)'); self::assertEquals('#NUM!', $sheet->getCell($cell)->getCalculatedValue(), 'Excel'); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2HexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2HexTest.php index ccb2ce793..e66b2cfbe 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2HexTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2HexTest.php @@ -42,6 +42,7 @@ class Bin2HexTest extends TestCase $sheet->getCell('A1')->setValue("=BIN2HEX($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerBIN2HEX(): array @@ -72,6 +73,7 @@ class Bin2HexTest extends TestCase $sheet->getCell('A1')->setValue("=BIN2HEX($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testBIN2HEXFrac(): void @@ -90,6 +92,7 @@ class Bin2HexTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=BIN2HEX(101.1)'); self::assertEquals('#NUM!', $sheet->getCell($cell)->getCalculatedValue()); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2OctTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2OctTest.php index 513901a84..74fb89dd5 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2OctTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Bin2OctTest.php @@ -42,6 +42,7 @@ class Bin2OctTest extends TestCase $sheet->getCell('A1')->setValue("=BIN2OCT($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerBIN2OCT(): array @@ -72,6 +73,7 @@ class Bin2OctTest extends TestCase $sheet->getCell('A1')->setValue("=BIN2OCT($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testBIN2OCTFrac(): void @@ -90,6 +92,7 @@ class Bin2OctTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=BIN2OCT(101.1)'); self::assertEquals('#NUM!', $sheet->getCell($cell)->getCalculatedValue()); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitAndTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitAndTest.php index d5d8a26a9..133151158 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitAndTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitAndTest.php @@ -25,6 +25,7 @@ class BitAndTest extends TestCase $sheet->getCell('A1')->setValue("=BITAND($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerBITAND(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitLShiftTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitLShiftTest.php index 246299ac3..bbe2ba27a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitLShiftTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitLShiftTest.php @@ -25,6 +25,7 @@ class BitLShiftTest extends TestCase $sheet->getCell('A1')->setValue("=BITLSHIFT($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerBITLSHIFT(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitOrTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitOrTest.php index 6addf05da..cb78873d6 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitOrTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitOrTest.php @@ -25,6 +25,7 @@ class BitOrTest extends TestCase $sheet->getCell('A1')->setValue("=BITOR($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerBITOR(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitRShiftTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitRShiftTest.php index 5c6f76c71..c14d3e798 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitRShiftTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitRShiftTest.php @@ -25,6 +25,7 @@ class BitRShiftTest extends TestCase $sheet->getCell('A1')->setValue("=BITRSHIFT($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerBITRSHIFT(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitXorTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitXorTest.php index ed8f2065c..27b1b0ae1 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitXorTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/BitXorTest.php @@ -25,6 +25,7 @@ class BitXorTest extends TestCase $sheet->getCell('A1')->setValue("=BITXOR($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerBITXOR(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ComplexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ComplexTest.php index 827654add..4d2a17b9f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ComplexTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ComplexTest.php @@ -3,10 +3,8 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PHPUnit\Framework\TestCase; -class ComplexTest extends TestCase +class ComplexTest extends AllSetupTeardown { /** * @dataProvider providerCOMPLEX @@ -15,16 +13,7 @@ class ComplexTest extends TestCase */ public function testCOMPLEX($expectedResult, ...$args): void { - if (count($args) === 0) { - $result = Engineering::COMPLEX(); - } elseif (count($args) === 1) { - $result = Engineering::COMPLEX($args[0]); - } elseif (count($args) === 2) { - $result = Engineering::COMPLEX($args[0], $args[1]); - } else { - $result = Engineering::COMPLEX($args[0], $args[1], $args[2]); - } - self::assertEquals($expectedResult, $result); + $this->runTestCase('COMPLEX', $expectedResult, ...$args); } public function providerCOMPLEX(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php index f15725cb5..56a0873a9 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php @@ -4,39 +4,38 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PHPUnit\Framework\TestCase; -class ConvertUoMTest extends TestCase +class ConvertUoMTest extends AllSetupTeardown { const UOM_PRECISION = 1E-12; public function testGetConversionGroups(): void { - $result = Engineering::getConversionGroups(); + $result = Engineering\ConvertUOM::getConversionCategories(); self::assertIsArray($result); } public function testGetConversionGroupUnits(): void { - $result = Engineering::getConversionGroupUnits(); + $result = Engineering\ConvertUOM::getConversionCategoryUnits(); self::assertIsArray($result); } public function testGetConversionGroupUnitDetails(): void { - $result = Engineering::getConversionGroupUnitDetails(); + $result = Engineering\ConvertUOM::getConversionCategoryUnitDetails(); self::assertIsArray($result); } public function testGetConversionMultipliers(): void { - $result = Engineering::getConversionMultipliers(); + $result = Engineering\ConvertUOM::getConversionMultipliers(); self::assertIsArray($result); } public function testGetBinaryConversionMultipliers(): void { - $result = Engineering::getBinaryConversionMultipliers(); + $result = Engineering\ConvertUOM::getBinaryConversionMultipliers(); self::assertIsArray($result); } @@ -47,8 +46,7 @@ class ConvertUoMTest extends TestCase */ public function testCONVERTUOM($expectedResult, ...$args): void { - $result = Engineering::CONVERTUOM(...$args); - self::assertEqualsWithDelta($expectedResult, $result, self::UOM_PRECISION); + $this->runTestCase('CONVERT', $expectedResult, ...$args); } public function providerCONVERTUOM(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2BinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2BinTest.php index db4c517d0..c346b12d0 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2BinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2BinTest.php @@ -42,6 +42,7 @@ class Dec2BinTest extends TestCase $sheet->getCell('A1')->setValue("=DEC2BIN($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerDEC2BIN(): array @@ -72,6 +73,7 @@ class Dec2BinTest extends TestCase $sheet->getCell('A1')->setValue("=DEC2BIN($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testDEC2BINFrac(): void @@ -90,6 +92,7 @@ class Dec2BinTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=DEC2BIN(5.1)'); self::assertEquals(101, $sheet->getCell($cell)->getCalculatedValue(), 'Excel'); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2HexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2HexTest.php index 6200ac567..7c6b51682 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2HexTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2HexTest.php @@ -43,6 +43,7 @@ class Dec2HexTest extends TestCase $sheet->getCell('A1')->setValue("=DEC2HEX($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerDEC2HEX(): array @@ -73,6 +74,7 @@ class Dec2HexTest extends TestCase $sheet->getCell('A1')->setValue("=DEC2HEX($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testDEC2HEXFrac(): void @@ -91,6 +93,7 @@ class Dec2HexTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=DEC2HEX(17.1)'); self::assertEquals(11, $sheet->getCell($cell)->getCalculatedValue(), 'Excel'); + $spreadsheet->disconnectWorksheets(); } public function test32bitHex(): void diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2OctTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2OctTest.php index 2e6007c5e..0f532287e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2OctTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Dec2OctTest.php @@ -42,6 +42,7 @@ class Dec2OctTest extends TestCase $sheet->getCell('A1')->setValue("=DEC2OCT($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerDEC2OCT(): array @@ -72,6 +73,7 @@ class Dec2OctTest extends TestCase $sheet->getCell('A1')->setValue("=DEC2OCT($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testDEC2OCTFrac(): void @@ -90,6 +92,7 @@ class Dec2OctTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=DEC2OCT(17.1)'); self::assertEquals(21, $sheet->getCell($cell)->getCalculatedValue(), 'Excel'); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/DeltaTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/DeltaTest.php index 41d809cac..c974c222e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/DeltaTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/DeltaTest.php @@ -3,28 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PHPUnit\Framework\TestCase; -class DeltaTest extends TestCase +class DeltaTest extends AllSetupTeardown { - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - } - /** * @dataProvider providerDELTA * - * @param mixed $a - * @param mixed $b * @param mixed $expectedResult */ - public function testDELTA($expectedResult, $a, $b): void + public function testDELTA($expectedResult, ...$args): void { - $result = Engineering::DELTA($a, $b); - self::assertEquals($expectedResult, $result); + $this->runTestCase('DELTA', $expectedResult, ...$args); } public function providerDELTA(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php index 88e808abe..df0246247 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfCTest.php @@ -3,23 +3,19 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PHPUnit\Framework\TestCase; -class ErfCTest extends TestCase +class ErfCTest extends AllSetupTeardown { const ERF_PRECISION = 1E-12; /** * @dataProvider providerERFC * - * @param mixed $lower * @param mixed $expectedResult */ - public function testERFC($expectedResult, $lower): void + public function testERFC($expectedResult, ...$args): void { - $result = Engineering::ERFC($lower); - self::assertEqualsWithDelta($expectedResult, $result, self::ERF_PRECISION); + $this->runTestCase('ERFC', $expectedResult, ...$args); } public function providerERFC(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php index 8a069ff14..b2181f19b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfPreciseTest.php @@ -3,23 +3,19 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PHPUnit\Framework\TestCase; -class ErfPreciseTest extends TestCase +class ErfPreciseTest extends AllSetupTeardown { const ERF_PRECISION = 1E-12; /** * @dataProvider providerERFPRECISE * - * @param mixed $limit * @param mixed $expectedResult */ - public function testERFPRECISE($expectedResult, $limit): void + public function testERFPRECISE($expectedResult, ...$args): void { - $result = Engineering::ERFPRECISE($limit); - self::assertEqualsWithDelta($expectedResult, $result, self::ERF_PRECISION); + $this->runTestCase('ERF.PRECISE', $expectedResult, ...$args); } public function providerERFPRECISE(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php index 26e0381ca..f7225caba 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ErfTest.php @@ -3,24 +3,19 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PHPUnit\Framework\TestCase; -class ErfTest extends TestCase +class ErfTest extends AllSetupTeardown { const ERF_PRECISION = 1E-12; /** * @dataProvider providerERF * - * @param mixed $lower - * @param null|mixed $upper * @param mixed $expectedResult */ - public function testERF($expectedResult, $lower, $upper = null): void + public function testERF($expectedResult, ...$args): void { - $result = Engineering::ERF($lower, $upper); - self::assertEqualsWithDelta($expectedResult, $result, self::ERF_PRECISION); + $this->runTestCase('ERF', $expectedResult, ...$args); } public function providerERF(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/GeStepTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/GeStepTest.php index 4e5b8ec5f..8bd728e16 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/GeStepTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/GeStepTest.php @@ -3,28 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PHPUnit\Framework\TestCase; -class GeStepTest extends TestCase +class GeStepTest extends AllSetupTeardown { - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - } - /** * @dataProvider providerGESTEP * - * @param mixed $a - * @param mixed $b * @param mixed $expectedResult */ - public function testGESTEP($expectedResult, $a, $b): void + public function testGESTEP($expectedResult, ...$args): void { - $result = Engineering::GESTEP($a, $b); - self::assertEquals($expectedResult, $result); + $this->runTestCase('GESTEP', $expectedResult, ...$args); } public function providerGESTEP(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2BinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2BinTest.php index f70d1943d..22c531882 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2BinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2BinTest.php @@ -42,6 +42,7 @@ class Hex2BinTest extends TestCase $sheet->getCell('A1')->setValue("=HEX2BIN($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerHEX2BIN(): array @@ -72,6 +73,7 @@ class Hex2BinTest extends TestCase $sheet->getCell('A1')->setValue("=HEX2BIN($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testHEX2BINFrac(): void @@ -93,6 +95,7 @@ class Hex2BinTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=HEX2BIN(10.1)'); self::assertEquals('#NUM!', $sheet->getCell($cell)->getCalculatedValue()); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2DecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2DecTest.php index 2e4ceeabb..e1bfdcf5f 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2DecTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2DecTest.php @@ -42,6 +42,7 @@ class Hex2DecTest extends TestCase $sheet->getCell('A1')->setValue("=HEX2DEC($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerHEX2DEC(): array @@ -72,6 +73,7 @@ class Hex2DecTest extends TestCase $sheet->getCell('A1')->setValue("=HEX2DEC($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testHEX2DECFrac(): void @@ -93,6 +95,7 @@ class Hex2DecTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=HEX2DEC(10.1)'); self::assertEquals('#NUM!', $sheet->getCell($cell)->getCalculatedValue(), 'Excel'); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2OctTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2OctTest.php index 449925dfb..557629edf 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2OctTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Hex2OctTest.php @@ -42,6 +42,7 @@ class Hex2OctTest extends TestCase $sheet->getCell('A1')->setValue("=HEX2OCT($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerHEX2OCT(): array @@ -69,6 +70,7 @@ class Hex2OctTest extends TestCase $sheet->getCell('A1')->setValue("=HEX2OCT($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testHEX2OCTFrac(): void @@ -90,6 +92,7 @@ class Hex2OctTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=HEX2OCT(10.1)'); self::assertEquals('#NUM!', $sheet->getCell($cell)->getCalculatedValue(), 'Excel'); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImAbsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImAbsTest.php index 417ee5c4e..35e9fef49 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImAbsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImAbsTest.php @@ -3,29 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PHPUnit\Framework\TestCase; -class ImAbsTest extends TestCase +class ImAbsTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - } - /** * @dataProvider providerIMABS * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMABS($expectedResult, $value): void + public function testIMABS($expectedResult, ...$args): void { - $result = Engineering::IMABS($value); - self::assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); + $this->runTestCase('IMABS', $expectedResult, ...$args); } public function providerIMABS(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImArgumentTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImArgumentTest.php index 359352b41..7e6a6f191 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImArgumentTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImArgumentTest.php @@ -3,29 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PHPUnit\Framework\TestCase; -class ImArgumentTest extends TestCase +class ImArgumentTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - } - /** * @dataProvider providerIMARGUMENT * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMARGUMENT($expectedResult, $value): void + public function testIMARGUMENT($expectedResult, ...$args): void { - $result = Engineering::IMARGUMENT($value); - self::assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); + $this->runTestCase('IMARGUMENT', $expectedResult, ...$args); } public function providerIMARGUMENT(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php index 7326bb7f1..23232f301 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImConjugateTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImConjugateTest extends TestCase +class ImConjugateTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMCONJUGATE * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMCONJUGATE($expectedResult, $value): void + public function testIMCONJUGATE($expectedResult, ...$args): void { - $result = Engineering::IMCONJUGATE($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMCONJUGATE', $expectedResult, ...$args); } public function providerIMCONJUGATE(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php index d9d8514b7..385eaf28e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCosTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImCosTest extends TestCase +class ImCosTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMCOS * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMCOS($expectedResult, $value): void + public function testIMCOS($expectedResult, ...$args): void { - $result = Engineering::IMCOS($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMCOS', $expectedResult, ...$args); } public function providerIMCOS(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php index 0d0466a1c..f34799f47 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCoshTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImCoshTest extends TestCase +class ImCoshTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMCOSH * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMCOSH($expectedResult, $value): void + public function testIMCOSH($expectedResult, ...$args): void { - $result = Engineering::IMCOSH($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMCOSH', $expectedResult, ...$args); } public function providerIMCOSH(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php index 7e178ed28..19454c260 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCotTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImCotTest extends TestCase +class ImCotTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMCOT * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMCOT($expectedResult, $value): void + public function testIMCOT($expectedResult, ...$args): void { - $result = Engineering::IMCOT($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMCOT', $expectedResult, ...$args); } public function providerIMCOT(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php index bb1ca92b9..36afcf4a0 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImCscTest extends TestCase +class ImCscTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMCSC * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMCSC($expectedResult, $value): void + public function testIMCSC($expectedResult, ...$args): void { - $result = Engineering::IMCSC($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMCSC', $expectedResult, ...$args); } public function providerIMCSC(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php index 5d5575fbf..d43f99913 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCschTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImCschTest extends TestCase +class ImCschTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMCSCH * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMCSCH($expectedResult, $value): void + public function testIMCSCH($expectedResult, ...$args): void { - $result = Engineering::IMCSCH($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMCSCH', $expectedResult, ...$args); } public function providerIMCSCH(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php index 58e9154b7..8bec13724 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImDivTest.php @@ -3,26 +3,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImDivTest extends TestCase +class ImDivTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMDIV * @@ -30,11 +13,7 @@ class ImDivTest extends TestCase */ public function testIMDIV($expectedResult, ...$args): void { - $result = Engineering::IMDIV(...$args); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMDIV', $expectedResult, ...$args); } public function providerIMDIV(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php index 5fc2dd2a8..9c9f05921 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImExpTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImExpTest extends TestCase +class ImExpTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMEXP * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMEXP($expectedResult, $value): void + public function testIMEXP($expectedResult, ...$args): void { - $result = Engineering::IMEXP($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMEXP', $expectedResult, ...$args); } public function providerIMEXP(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php index ad157ecb7..7b1e15834 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLnTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImLnTest extends TestCase +class ImLnTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMLN * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMLN($expectedResult, $value): void + public function testIMLN($expectedResult, ...$args): void { - $result = Engineering::IMLN($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMLN', $expectedResult, ...$args); } public function providerIMLN(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php index 47503f5e8..931ece819 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog10Test.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImLog10Test extends TestCase +class ImLog10Test extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMLOG10 * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMLOG10($expectedResult, $value): void + public function testIMLOG10($expectedResult, ...$args): void { - $result = Engineering::IMLOG10($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMLOG10', $expectedResult, ...$args); } public function providerIMLOG10(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php index 2ea38872d..93ea0fb34 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImLog2Test.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImLog2Test extends TestCase +class ImLog2Test extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMLOG2 * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMLOG2($expectedResult, $value): void + public function testIMLOG2($expectedResult, ...$args): void { - $result = Engineering::IMLOG2($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMLOG2', $expectedResult, ...$args); } public function providerIMLOG2(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php index af4f5cf90..c545cbe2e 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImPowerTest.php @@ -3,26 +3,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImPowerTest extends TestCase +class ImPowerTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMPOWER * @@ -30,11 +13,7 @@ class ImPowerTest extends TestCase */ public function testIMPOWER($expectedResult, ...$args): void { - $result = Engineering::IMPOWER(...$args); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMPOWER', $expectedResult, ...$args); } public function providerIMPOWER(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php index 845d436fd..f31049c99 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImProductTest.php @@ -2,26 +2,8 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; - -class ImProductTest extends TestCase +class ImProductTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMPRODUCT * @@ -29,11 +11,7 @@ class ImProductTest extends TestCase */ public function testIMPRODUCT($expectedResult, ...$args): void { - $result = Engineering::IMPRODUCT(...$args); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMPRODUCT', $expectedResult, ...$args); } public function providerIMPRODUCT(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImRealTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImRealTest.php index b12837e75..356b3fc11 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImRealTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImRealTest.php @@ -3,29 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PHPUnit\Framework\TestCase; -class ImRealTest extends TestCase +class ImRealTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - } - /** * @dataProvider providerIMREAL * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMREAL($expectedResult, $value): void + public function testIMREAL($expectedResult, ...$args): void { - $result = Engineering::IMREAL($value); - self::assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); + $this->runComplexTestCase('IMREAL', $expectedResult, ...$args); } public function providerIMREAL(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php index 33880aad2..bb63e7e31 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSecTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImSecTest extends TestCase +class ImSecTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMSEC * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMSEC($expectedResult, $value): void + public function testIMSEC($expectedResult, ...$args): void { - $result = Engineering::IMSEC($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMSEC', $expectedResult, ...$args); } public function providerIMSEC(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php index bf4285a26..11592d810 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSechTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImSechTest extends TestCase +class ImSechTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMSECH * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMSECH($expectedResult, $value): void + public function testIMSECH($expectedResult, ...$args): void { - $result = Engineering::IMSECH($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMSECH', $expectedResult, ...$args); } public function providerIMSECH(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php index 515ebc47c..e8986e745 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImSinTest extends TestCase +class ImSinTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMSIN * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMSIN($expectedResult, $value): void + public function testIMSIN($expectedResult, ...$args): void { - $result = Engineering::IMSIN($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMSIN', $expectedResult, ...$args); } public function providerIMSIN(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php index c6db78893..44c8d9202 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSinhTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImSinhTest extends TestCase +class ImSinhTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMSINH * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMSINH($expectedResult, $value): void + public function testIMSINH($expectedResult, ...$args): void { - $result = Engineering::IMSINH($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMSINH', $expectedResult, ...$args); } public function providerIMSINH(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php index 261cf51ae..5fae15114 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSqrtTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImSqrtTest extends TestCase +class ImSqrtTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMSQRT * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMSQRT($expectedResult, $value): void + public function testIMSQRT($expectedResult, ...$args): void { - $result = Engineering::IMSQRT($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMSQRT', $expectedResult, ...$args); } public function providerIMSQRT(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php index a8d1d1d77..72c2461bd 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSubTest.php @@ -3,26 +3,9 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImSubTest extends TestCase +class ImSubTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMSUB * @@ -30,11 +13,7 @@ class ImSubTest extends TestCase */ public function testIMSUB($expectedResult, ...$args): void { - $result = Engineering::IMSUB(...$args); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMSUB', $expectedResult, ...$args); } public function providerIMSUB(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php index 0620c6843..43282d3b2 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImSumTest.php @@ -2,26 +2,8 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; - -class ImSumTest extends TestCase +class ImSumTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMSUM * @@ -29,11 +11,7 @@ class ImSumTest extends TestCase */ public function testIMSUM($expectedResult, ...$args): void { - $result = Engineering::IMSUM(...$args); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMSUM', $expectedResult, ...$args); } public function providerIMSUM(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php index ca66b2b85..34c98c6be 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImTanTest.php @@ -3,39 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert; -use PHPUnit\Framework\TestCase; -class ImTanTest extends TestCase +class ImTanTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - /** - * @var ComplexAssert - */ - private $complexAssert; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - $this->complexAssert = new ComplexAssert(); - } - /** * @dataProvider providerIMTAN * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMTAN($expectedResult, $value): void + public function testIMTAN($expectedResult, ...$args): void { - $result = Engineering::IMTAN($value); - self::assertTrue( - $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION), - $this->complexAssert->getErrorMessage() - ); + $this->runComplexTestCase('IMTAN', $expectedResult, ...$args); } public function providerIMTAN(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImaginaryTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImaginaryTest.php index 59ad1eb8c..9d52755c7 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImaginaryTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImaginaryTest.php @@ -3,29 +3,17 @@ namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering; use PhpOffice\PhpSpreadsheet\Calculation\Calculation; -use PhpOffice\PhpSpreadsheet\Calculation\Engineering; -use PhpOffice\PhpSpreadsheet\Calculation\Functions; -use PHPUnit\Framework\TestCase; -class ImaginaryTest extends TestCase +class ImaginaryTest extends AllSetupTeardown { - const COMPLEX_PRECISION = 1E-8; - - protected function setUp(): void - { - Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); - } - /** * @dataProvider providerIMAGINARY * * @param mixed $expectedResult - * @param mixed $value */ - public function testIMAGINARY($expectedResult, $value): void + public function testIMAGINARY($expectedResult, ...$args): void { - $result = Engineering::IMAGINARY($value); - self::assertEqualsWithDelta($expectedResult, $result, self::COMPLEX_PRECISION); + $this->runTestCase('IMAGINARY', $expectedResult, ...$args); } public function providerIMAGINARY(): array diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/MovedBitwiseTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/MovedBitwiseTest.php index 457db0d30..2de8ee769 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/MovedBitwiseTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/MovedBitwiseTest.php @@ -15,10 +15,10 @@ class MovedBitwiseTest extends TestCase { public function testMovedFunctions(): void { - self::assertEquals(1, Engineering::BITAND(1, 3)); - self::assertEquals(3, Engineering::BITOR(1, 3)); - self::assertEquals(2, Engineering::BITXOR(1, 3)); - self::assertEquals(32, Engineering::BITLSHIFT(8, 2)); - self::assertEquals(2, Engineering::BITRSHIFT(8, 2)); + self::assertEquals(1, /** @scrutinizer ignore-deprecated */ Engineering::BITAND(1, 3)); + self::assertEquals(3, /** @scrutinizer ignore-deprecated */ Engineering::BITOR(1, 3)); + self::assertEquals(2, /** @scrutinizer ignore-deprecated */ Engineering::BITXOR(1, 3)); + self::assertEquals(32, /** @scrutinizer ignore-deprecated */ Engineering::BITLSHIFT(8, 2)); + self::assertEquals(2, /** @scrutinizer ignore-deprecated */ Engineering::BITRSHIFT(8, 2)); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/MovedFunctionsTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/MovedFunctionsTest.php index 04ebb131d..4aea74ac9 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/MovedFunctionsTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/MovedFunctionsTest.php @@ -15,17 +15,17 @@ class MovedFunctionsTest extends TestCase { public function testMovedFunctions(): void { - self::assertEquals(178, Engineering::BINTODEC(10110010)); - self::assertEquals('B2', Engineering::BINTOHEX(10110010)); - self::assertEquals(144, Engineering::BINTOOCT(1100100)); - self::assertEquals(101100101, Engineering::DECTOBIN(357)); - self::assertEquals(165, Engineering::DECTOHEX(357)); - self::assertEquals(545, Engineering::DECTOOCT(357)); - self::assertEquals(1100100, Engineering::HEXTOBIN(64)); - self::assertEquals(357, Engineering::HEXTODEC(165)); - self::assertEquals(653, Engineering::HEXTOOCT('01AB')); - self::assertEquals(1100100, Engineering::OCTTOBIN(144)); - self::assertEquals(357, Engineering::OCTTODEC(545)); - self::assertEquals('1AB', Engineering::OCTTOHEX(653)); + self::assertEquals(178, /** @scrutinizer ignore-deprecated */ Engineering::BINTODEC(10110010)); + self::assertEquals('B2', /** @scrutinizer ignore-deprecated */ Engineering::BINTOHEX(10110010)); + self::assertEquals(144, /** @scrutinizer ignore-deprecated */ Engineering::BINTOOCT(1100100)); + self::assertEquals(101100101, /** @scrutinizer ignore-deprecated */ Engineering::DECTOBIN(357)); + self::assertEquals(165, /** @scrutinizer ignore-deprecated */ Engineering::DECTOHEX(357)); + self::assertEquals(545, /** @scrutinizer ignore-deprecated */ Engineering::DECTOOCT(357)); + self::assertEquals(1100100, /** @scrutinizer ignore-deprecated */ Engineering::HEXTOBIN(64)); + self::assertEquals(357, /** @scrutinizer ignore-deprecated */ Engineering::HEXTODEC(165)); + self::assertEquals(653, /** @scrutinizer ignore-deprecated */ Engineering::HEXTOOCT('01AB')); + self::assertEquals(1100100, /** @scrutinizer ignore-deprecated */ Engineering::OCTTOBIN(144)); + self::assertEquals(357, /** @scrutinizer ignore-deprecated */ Engineering::OCTTODEC(545)); + self::assertEquals('1AB', /** @scrutinizer ignore-deprecated */ Engineering::OCTTOHEX(653)); } } diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2BinTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2BinTest.php index 39c8c1d97..cd8c5a5a3 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2BinTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2BinTest.php @@ -42,6 +42,7 @@ class Oct2BinTest extends TestCase $sheet->getCell('A1')->setValue("=OCT2BIN($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerOCT2BIN(): array @@ -72,6 +73,7 @@ class Oct2BinTest extends TestCase $sheet->getCell('A1')->setValue("=OCT2BIN($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testOCT2BINFrac(): void @@ -90,6 +92,7 @@ class Oct2BinTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=OCT2BIN(10.1)'); self::assertEquals('#NUM!', $sheet->getCell($cell)->getCalculatedValue()); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2DecTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2DecTest.php index e814e76df..eb692aff5 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2DecTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2DecTest.php @@ -42,6 +42,7 @@ class Oct2DecTest extends TestCase $sheet->getCell('A1')->setValue("=OCT2DEC($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerOCT2DEC(): array @@ -72,6 +73,7 @@ class Oct2DecTest extends TestCase $sheet->getCell('A1')->setValue("=OCT2DEC($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testOCT2DECFrac(): void @@ -90,6 +92,7 @@ class Oct2DecTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=OCT2DEC(10.1)'); self::assertEquals('#NUM!', $sheet->getCell($cell)->getCalculatedValue()); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2HexTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2HexTest.php index 0f38752f7..4aabf3b21 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2HexTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/Oct2HexTest.php @@ -42,6 +42,7 @@ class Oct2HexTest extends TestCase $sheet->getCell('A1')->setValue("=OCT2HEX($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function providerOCT2HEX(): array @@ -72,6 +73,7 @@ class Oct2HexTest extends TestCase $sheet->getCell('A1')->setValue("=OCT2HEX($formula)"); $result = $sheet->getCell('A1')->getCalculatedValue(); self::assertEquals($expectedResult, $result); + $spreadsheet->disconnectWorksheets(); } public function testOCT2HEXFrac(): void @@ -90,6 +92,7 @@ class Oct2HexTest extends TestCase $cell = 'E1'; $sheet->setCellValue($cell, '=OCT2HEX(20.1)'); self::assertEquals('#NUM!', $sheet->getCell($cell)->getCalculatedValue()); + $spreadsheet->disconnectWorksheets(); } /** diff --git a/tests/data/Calculation/Engineering/IMSUB.php b/tests/data/Calculation/Engineering/IMSUB.php index ea5ed12d3..c3b85ff3b 100644 --- a/tests/data/Calculation/Engineering/IMSUB.php +++ b/tests/data/Calculation/Engineering/IMSUB.php @@ -27,6 +27,11 @@ return [ '-111.11-62.22i', '12.34+5.67i', '123.45+67.89i', + ], + 'too many arguments' => [ + 'exception', + '12.34+5.67i', + '123.45+67.89i', '123.45+67.89i', ], [