forked from GNUsocial/gnu-social
[TESTS] Fix Entity test in accordance with the changes to createOrUpdate
This commit is contained in:
parent
b5de80303a
commit
57f43108bb
@ -23,7 +23,6 @@ namespace App\Tests\Core;
|
|||||||
|
|
||||||
use App\Core\DB\DB;
|
use App\Core\DB\DB;
|
||||||
use App\Entity\LocalUser;
|
use App\Entity\LocalUser;
|
||||||
use App\Util\Exception\NotFoundException;
|
|
||||||
use App\Util\GNUsocialTestCase;
|
use App\Util\GNUsocialTestCase;
|
||||||
use Jchook\AssertThrows\AssertThrows;
|
use Jchook\AssertThrows\AssertThrows;
|
||||||
|
|
||||||
@ -48,11 +47,14 @@ class EntityTest extends GNUsocialTestCase
|
|||||||
|
|
||||||
public function testCreateOrUpdate()
|
public function testCreateOrUpdate()
|
||||||
{
|
{
|
||||||
$user = LocalUser::createOrUpdate(['nickname' => 'taken_user']);
|
[$user, $is_update] = LocalUser::createOrUpdate(['nickname' => 'taken_user']);
|
||||||
static::assertNotNull($user);
|
static::assertNotNull($user);
|
||||||
static::assertThrows(NotFoundException::class, fn () => LocalUser::createOrUpdate(['nickname' => 'taken_user', 'outgoing_email' => 'foo@bar']));
|
static::assertTrue($is_update);
|
||||||
$user = LocalUser::createOrUpdate(['nickname' => 'taken_user', 'outgoing_email' => 'foo@bar'], find_by_keys: ['nickname']);
|
[, $is_update] = LocalUser::createOrUpdate(['nickname' => 'taken_user', 'outgoing_email' => 'foo@bar']);
|
||||||
|
static::assertFalse($is_update);
|
||||||
|
[$user, $is_update] = LocalUser::createOrUpdate(['nickname' => 'taken_user', 'outgoing_email' => 'foo@bar'], find_by_keys: ['nickname']);
|
||||||
static::assertSame('foo@bar', $user->getOutgoingEmail());
|
static::assertSame('foo@bar', $user->getOutgoingEmail());
|
||||||
|
static::assertTrue($is_update);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetWithPK()
|
public function testGetWithPK()
|
||||||
|
Loading…
Reference in New Issue
Block a user