Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[9.x] Remove deprecation warnings in test output #45998

Merged
merged 3 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions tests/Cache/CacheArrayStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ public function testValuesAreNotStoredByReference()
$store->put('object', $object, 10);
$object->bar = true;

$this->assertObjectNotHasAttribute('bar', $store->get('object'));
$retrievedObject = $store->get('object');

$this->assertTrue($retrievedObject->foo);
$this->assertFalse(property_exists($retrievedObject, 'bar'));
}

public function testValuesAreStoredByReferenceIfSerializationIsDisabled()
Expand All @@ -260,7 +263,10 @@ public function testValuesAreStoredByReferenceIfSerializationIsDisabled()
$store->put('object', $object, 10);
$object->bar = true;

$this->assertObjectHasAttribute('bar', $store->get('object'));
$retrievedObject = $store->get('object');

$this->assertTrue($retrievedObject->foo);
$this->assertTrue($retrievedObject->bar);
}

public function testReleasingLockAfterAlreadyForceReleasedByAnotherOwnerFails()
Expand Down
4 changes: 2 additions & 2 deletions tests/Database/DatabaseQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2024,15 +2024,15 @@ public function testWhereNot()
public function testIncrementManyArgumentValidation1()
{
$this->expectException(InvalidArgumentException::class);
$this->expectErrorMessage('Non-numeric value passed as increment amount for column: \'col\'.');
$this->expectExceptionMessage('Non-numeric value passed as increment amount for column: \'col\'.');
$builder = $this->getBuilder();
$builder->from('users')->incrementEach(['col' => 'a']);
}

public function testIncrementManyArgumentValidation2()
{
$this->expectException(InvalidArgumentException::class);
$this->expectErrorMessage('Non-associative array passed to incrementEach method.');
$this->expectExceptionMessage('Non-associative array passed to incrementEach method.');
$builder = $this->getBuilder();
$builder->from('users')->incrementEach([11 => 11]);
}
Expand Down
5 changes: 3 additions & 2 deletions tests/Events/EventsDispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Tests\Events;

use Error;
use Exception;
use Illuminate\Container\Container;
use Illuminate\Events\Dispatcher;
Expand Down Expand Up @@ -574,8 +575,8 @@ public function testInvokeIsCalled()
// It throws an "Error" when there is no method to be called.
$d = new Dispatcher;
$d->listen('myEvent', TestListenerLean::class);
$this->expectError();
$this->expectErrorMessage('Call to undefined method '.TestListenerLean::class.'::__invoke()');
$this->expectException(Error::class);
$this->expectExceptionMessage('Call to undefined method '.TestListenerLean::class.'::__invoke()');
$d->dispatch('myEvent', 'somePayload');

driesvints marked this conversation as resolved.
Show resolved Hide resolved
unset($_SERVER['__event.test']);
Expand Down
4 changes: 2 additions & 2 deletions tests/Support/LotteryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ public function testItCanHandleMissingSequenceItems()
$this->assertSame('winner', $result);

$this->expectException(RuntimeException::class);
$this->expectErrorMessage('Missing key in sequence.');
$this->expectExceptionMessage('Missing key in sequence.');
Lottery::odds(1, 10000)->winner(fn () => 'winner')->loser(fn () => 'loser')->choose();
}

public function testItThrowsForFloatsOverOne()
{
$this->expectException(RuntimeException::class);
$this->expectErrorMessage('Float must not be greater than 1.');
$this->expectExceptionMessage('Float must not be greater than 1.');

new Lottery(1.1);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Validation/ValidationValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ public function prohibitedRulesData()
{
$emptyCountable = new class implements Countable
{
public function count()
public function count(): int
{
return 0;
}
Expand Down