assertSame() with primitive types
Closed this issue · 1 comments
dereuromark commented
assertSame()
- assertSame(null, ...) => assertNull(...)
- assertSame(true, ...) => assertTrue(...)
- assertSame(false, ...) => assertFalse(...)
Since there is no usage of assertNotSame() in this context, I think we can skip the negative form here. Just too rare.
Index: Bundles/Transfer/tests/SprykerTest/Zed/Transfer/Business/Model/GeneratedTransferTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Bundles/Transfer/tests/SprykerTest/Zed/Transfer/Business/Model/GeneratedTransferTest.php b/Bundles/Transfer/tests/SprykerTest/Zed/Transfer/Business/Model/GeneratedTransferTest.php
--- a/Bundles/Transfer/tests/SprykerTest/Zed/Transfer/Business/Model/GeneratedTransferTest.php (revision 8e8c32bbe8d5641835c444fd4d4f9f0fbdef2f2e)
+++ b/Bundles/Transfer/tests/SprykerTest/Zed/Transfer/Business/Model/GeneratedTransferTest.php (date 1620829349718)
@@ -179,7 +179,7 @@
{
$generatedTransfer = new GeneratedTransfer();
$generatedTransfer->setTestBool(true);
- $this->assertSame(true, $generatedTransfer->getTestBool());
+ $this->assertTrue($generatedTransfer->getTestBool());
$this->assertIsBool($generatedTransfer->getTestBool());
$modified = $generatedTransfer->modifiedToArray();
@@ -358,7 +358,7 @@
$this->assertSame(['string a', 'string b'], $generatedTransfer->getTestStringArray());
$this->assertSame(100, $generatedTransfer->getTestInt());
$this->assertSame([100, 200], $generatedTransfer->getTestIntArray());
- $this->assertSame(true, $generatedTransfer->getTestBool());
+ $this->assertTrue($generatedTransfer->getTestBool());
$this->assertSame([true, false], $generatedTransfer->getTestBoolArray());
$this->assertSame([true, false], $generatedTransfer->getTestBoolArray());
$this->assertInstanceOf(GeneratedTransfer::class, $generatedTransfer->getTestTransfer());
Index: Bundles/PriceProduct/tests/SprykerTest/Service/PriceProduct/PriceProductServiceTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Bundles/PriceProduct/tests/SprykerTest/Service/PriceProduct/PriceProductServiceTest.php b/Bundles/PriceProduct/tests/SprykerTest/Service/PriceProduct/PriceProductServiceTest.php
--- a/Bundles/PriceProduct/tests/SprykerTest/Service/PriceProduct/PriceProductServiceTest.php (revision 8e8c32bbe8d5641835c444fd4d4f9f0fbdef2f2e)
+++ b/Bundles/PriceProduct/tests/SprykerTest/Service/PriceProduct/PriceProductServiceTest.php (date 1620829349718)
@@ -270,7 +270,7 @@
$result = $this->getPriceProductService()->resolveProductPriceByPriceProductCriteria($priceProductTransfers, $priceProductCriteriaTransfer);
// Assert
- $this->assertSame(null, $result);
+ $this->assertNull($result);
}
/**
Index: Bundles/Vault/tests/SprykerTest/Zed/Vault/Business/VaultFacadeTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Bundles/Vault/tests/SprykerTest/Zed/Vault/Business/VaultFacadeTest.php b/Bundles/Vault/tests/SprykerTest/Zed/Vault/Business/VaultFacadeTest.php
--- a/Bundles/Vault/tests/SprykerTest/Zed/Vault/Business/VaultFacadeTest.php (revision 8e8c32bbe8d5641835c444fd4d4f9f0fbdef2f2e)
+++ b/Bundles/Vault/tests/SprykerTest/Zed/Vault/Business/VaultFacadeTest.php (date 1620829349718)
@@ -52,7 +52,7 @@
$isSuccessful = $vaultFacade->store(static::TEST_DATA_TYPE, static::TEST_DATA_KEY, static::TEST_DATA);
//Assert
- $this->assertSame(true, $isSuccessful);
+ $this->assertTrue($isSuccessful);
$vaultDepositsCount = SpyVaultDepositQuery::create()
->filterByDataType(static::TEST_DATA_TYPE)
Index: Bundles/PriceCartConnector/tests/SprykerTest/Zed/PriceCartConnector/Business/Manager/PriceManagerTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Bundles/PriceCartConnector/tests/SprykerTest/Zed/PriceCartConnector/Business/Manager/PriceManagerTest.php b/Bundles/PriceCartConnector/tests/SprykerTest/Zed/PriceCartConnector/Business/Manager/PriceManagerTest.php
--- a/Bundles/PriceCartConnector/tests/SprykerTest/Zed/PriceCartConnector/Business/Manager/PriceManagerTest.php (revision 8e8c32bbe8d5641835c444fd4d4f9f0fbdef2f2e)
+++ b/Bundles/PriceCartConnector/tests/SprykerTest/Zed/PriceCartConnector/Business/Manager/PriceManagerTest.php (date 1620829349718)
@@ -115,7 +115,7 @@
$modifiedItemIterator->next();
$this->assertSame(2000, $modifiedItemIterator->current()->getOriginUnitGrossPrice());
- $this->assertSame(null, $modifiedItemIterator->current()->getSourceUnitGrossPrice());
+ $this->assertNull($modifiedItemIterator->current()->getSourceUnitGrossPrice());
$this->assertSame(2000, $modifiedItemIterator->current()->getUnitGrossPrice());
$modifiedItemIterator->next();
Index: Bundles/CartVariant/tests/SprykerTest/Yves/CartVariant/Model/Mapper/AvailabilityMapperTest.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Bundles/CartVariant/tests/SprykerTest/Yves/CartVariant/Model/Mapper/AvailabilityMapperTest.php b/Bundles/CartVariant/tests/SprykerTest/Yves/CartVariant/Model/Mapper/AvailabilityMapperTest.php
--- a/Bundles/CartVariant/tests/SprykerTest/Yves/CartVariant/Model/Mapper/AvailabilityMapperTest.php (revision 8e8c32bbe8d5641835c444fd4d4f9f0fbdef2f2e)
+++ b/Bundles/CartVariant/tests/SprykerTest/Yves/CartVariant/Model/Mapper/AvailabilityMapperTest.php (date 1620829349718)
@@ -35,7 +35,7 @@
$availability = $result['170_28516206'];
$this->assertArrayHasKey('concreteProductAvailableItems', $availability);
- $this->assertSame(true, (bool)$availability['concreteProductAvailableItems']);
+ $this->assertTrue((bool)$availability['concreteProductAvailableItems']);
}
/**
should be auto fixable
dereuromark commented