fix tests
This commit is contained in:
@@ -58,13 +58,13 @@ class CurrencyConverterTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = new Currency(2.0, 'USD');
|
||||
|
||||
$converer = new CurrencyConverter($currencyConfigDataProvider);
|
||||
$converter = new CurrencyConverter($currencyConfigDataProvider);
|
||||
|
||||
$convertedValue = $converer->convert($value, 'EUR');
|
||||
$convertedValue = $converter->convert($value, 'EUR');
|
||||
|
||||
$this->assertEquals('EUR', $convertedValue->getCode());
|
||||
|
||||
$this->assertEquals(2.0 / 1.2, $convertedValue->getAmount());
|
||||
$this->assertEquals(round(2.0 / 1.2, 10), round($convertedValue->getAmount(), 10));
|
||||
}
|
||||
|
||||
public function testConvert2()
|
||||
@@ -88,13 +88,13 @@ class CurrencyConverterTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = new Currency(2.0, 'UAH');
|
||||
|
||||
$converer = new CurrencyConverter($currencyConfigDataProvider);
|
||||
$converter = new CurrencyConverter($currencyConfigDataProvider);
|
||||
|
||||
$convertedValue = $converer->convert($value, 'EUR');
|
||||
$convertedValue = $converter->convert($value, 'EUR');
|
||||
|
||||
$this->assertEquals('EUR', $convertedValue->getCode());
|
||||
|
||||
$this->assertEquals(2.0 * 0.035 / 1.2, $convertedValue->getAmount());
|
||||
$this->assertEquals(round(2.0 * 0.035 / 1.2, 10), round($convertedValue->getAmount(), 10));
|
||||
}
|
||||
|
||||
public function testConvertToDefault()
|
||||
@@ -122,13 +122,13 @@ class CurrencyConverterTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = new Currency(2.0, 'EUR');
|
||||
|
||||
$converer = new CurrencyConverter($currencyConfigDataProvider);
|
||||
$converter = new CurrencyConverter($currencyConfigDataProvider);
|
||||
|
||||
$convertedValue = $converer->convertToDefault($value);
|
||||
$convertedValue = $converter->convertToDefault($value);
|
||||
|
||||
$this->assertEquals('USD', $convertedValue->getCode());
|
||||
|
||||
$this->assertEquals(2.0 * 1.2, $convertedValue->getAmount());
|
||||
$this->assertEquals(round(2.0 * 1.2, 10), round($convertedValue->getAmount(), 10));
|
||||
}
|
||||
|
||||
public function testConvertWithRates()
|
||||
@@ -143,12 +143,12 @@ class CurrencyConverterTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$value = new Currency(2.0, 'UAH');
|
||||
|
||||
$converer = new CurrencyConverter($currencyConfigDataProvider);
|
||||
$converter = new CurrencyConverter($currencyConfigDataProvider);
|
||||
|
||||
$convertedValue = $converer->convertWithRates($value, 'EUR', $rates);
|
||||
$convertedValue = $converter->convertWithRates($value, 'EUR', $rates);
|
||||
|
||||
$this->assertEquals('EUR', $convertedValue->getCode());
|
||||
|
||||
$this->assertEquals(2.0 * 0.035 / 1.2, $convertedValue->getAmount());
|
||||
$this->assertEquals(round(2.0 * 0.035 / 1.2, 10), round($convertedValue->getAmount(), 10));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,9 +346,7 @@ class MetadataTest extends \PHPUnit\Framework\TestCase
|
||||
public function testGetObjects()
|
||||
{
|
||||
$this->assertEquals('System', $this->object->getObjects('app.adminPanel.system.label'));
|
||||
|
||||
$this->assertObjectHasAttribute('fields', $this->object->getObjects('entityDefs.User'));
|
||||
|
||||
$this->assertObjectHasAttribute('type', $this->object->getObjects('entityDefs.User.fields.name'));
|
||||
$this->assertObjectHasProperty('fields', $this->object->getObjects('entityDefs.User'));
|
||||
$this->assertObjectHasProperty('type', $this->object->getObjects('entityDefs.User.fields.name'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
namespace tests\Espo\Core\Utils;
|
||||
namespace tests\unit\Espo\Core\Utils;
|
||||
|
||||
use Espo\Core\Utils\Util;
|
||||
|
||||
@@ -1385,7 +1385,7 @@ class UtilTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertEquals($result, Util::unsetInArray($input, $unsets, true));
|
||||
}
|
||||
|
||||
public function testGetValueByKey()
|
||||
public function testGetValueByKey1()
|
||||
{
|
||||
$inputArray = [
|
||||
'Account' => [
|
||||
@@ -1409,13 +1409,13 @@ class UtilTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
$this->assertEquals('125', Util::getValueByKey($inputArray, 'Account.sub.subV'));
|
||||
|
||||
$result = array('useCache' => true, );
|
||||
$result = ['useCache' => true];
|
||||
$this->assertEquals($result, Util::getValueByKey($inputArray, 'Contact'));
|
||||
|
||||
$this->assertNull(Util::getValueByKey($inputArray, 'Contact.notExists'));
|
||||
|
||||
$this->assertEquals('customReturns', Util::getValueByKey($inputArray, 'Contact.notExists', 'customReturns'));
|
||||
$this->assertNotEquals('customReturns', Util::getValueByKey($inputArray, 'Contact.useCache', 'customReturns'));
|
||||
$this->assertTrue(Util::getValueByKey($inputArray, 'Contact.useCache', 'customReturns'));
|
||||
}
|
||||
|
||||
public function testGetValueByKey2()
|
||||
@@ -1487,7 +1487,7 @@ class UtilTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertNull(Util::getValueByKey($inputObject, 'Contact.notExists'));
|
||||
|
||||
$this->assertEquals('customReturns', Util::getValueByKey($inputObject, 'Contact.notExists', 'customReturns'));
|
||||
$this->assertNotEquals('customReturns', Util::getValueByKey($inputObject, 'Contact.useCache', 'customReturns'));
|
||||
$this->assertTrue(Util::getValueByKey($inputObject, 'Contact.useCache', 'customReturns'));
|
||||
}
|
||||
|
||||
public function testUnsetInArrayByValue()
|
||||
|
||||
Reference in New Issue
Block a user