-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
self::assert*()
instead of $this->assert*()
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ public function testShouldUseTheGivenCacheKeyIfPresent() | |
$connectionParams | ||
); | ||
|
||
$this->assertEquals(self::CACHE_KEY, $cacheKey, 'The returned cache key should match the given one'); | ||
self::assertEquals(self::CACHE_KEY, $cacheKey, 'The returned cache key should match the given one'); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Majkl578
Contributor
|
||
} | ||
|
||
public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven() | ||
|
@@ -66,13 +66,13 @@ public function testShouldGenerateAnAutomaticKeyIfNoKeyHasBeenGiven() | |
$connectionParams | ||
); | ||
|
||
$this->assertNotEquals( | ||
self::assertNotEquals( | ||
self::CACHE_KEY, | ||
$cacheKey, | ||
'The returned cache key should be generated automatically' | ||
); | ||
|
||
$this->assertNotEmpty($cacheKey, 'The generated cache key should not be empty'); | ||
self::assertNotEmpty($cacheKey, 'The generated cache key should not be empty'); | ||
} | ||
|
||
public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferentConnections() | ||
|
@@ -107,7 +107,7 @@ public function testShouldGenerateDifferentKeysForSameQueryAndParamsAndDifferent | |
$connectionParams | ||
); | ||
|
||
$this->assertNotEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be different'); | ||
self::assertNotEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be different'); | ||
} | ||
|
||
public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges() | ||
|
@@ -140,6 +140,6 @@ public function testShouldGenerateSameKeysIfNoneOfTheParamsChanges() | |
$connectionParams | ||
); | ||
|
||
$this->assertEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be the same'); | ||
self::assertEquals($firstCacheKey, $secondCacheKey, 'Cache keys should be the same'); | ||
} | ||
} |
Would you mind explaining the rationale behind this change ?
The methods are indeed static and can be called statically, but PHPUnit author recommends
$this->assert
, the official documentation use$this->assert
everywhere and a quick search on GitHub shows that there is huge majority using$this->assert
with ~45 millions occurences against ~5 millions forself::assert
.So what made you decide that it is no longer appropriate to follow recommendations and the majority ?
Also do you plan on changing other projects, such as doctrine/doctrine2, for consistency ?