forked from GNUsocial/gnu-social
[TESTS] Fix Core/DB/UpdateListenerTest
This commit is contained in:
parent
e67ed58286
commit
1bdeac7076
@ -23,6 +23,7 @@ namespace App\Tests\Core\DB;
|
||||
|
||||
use App\Core\DB\DB;
|
||||
use App\Core\DB\UpdateListener;
|
||||
use App\Entity\Actor;
|
||||
use App\Util\GNUsocialTestCase;
|
||||
use DateTime;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
@ -33,7 +34,7 @@ class UpdateListenerTest extends GNUsocialTestCase
|
||||
public function testPreUpdateExists()
|
||||
{
|
||||
static::bootKernel();
|
||||
$actor = DB::findOneBy('actor', ['nickname' => 'taken_user']);
|
||||
$actor = DB::findOneBy(Actor::class, ['nickname' => 'taken_user']);
|
||||
$date = new DateTime('1999-09-23');
|
||||
$actor->setModified($date);
|
||||
static::assertSame($actor->getModified(), $date);
|
||||
@ -50,12 +51,12 @@ class UpdateListenerTest extends GNUsocialTestCase
|
||||
public function testPreUpdateDoesNotExist()
|
||||
{
|
||||
static::bootKernel();
|
||||
$group_inbox = DB::dql('select gi from group_inbox gi join local_group lg with gi.group_id = lg.group_id where lg.nickname = :nickname', ['nickname' => 'taken_group'])[0];
|
||||
static::assertTrue(!method_exists($group_inbox, 'setModified'));
|
||||
$attention = DB::dql('SELECT att FROM Component\Notification\Entity\Attention att JOIN local_group lg WITH att.target_id = lg.actor_id WHERE lg.nickname = :nickname', ['nickname' => 'taken_group'])[0];
|
||||
static::assertTrue(!method_exists($attention, 'setModified'));
|
||||
|
||||
$em = static::$container->get(EntityManagerInterface::class);
|
||||
$change_set = [];
|
||||
$args = new PreUpdateEventArgs($group_inbox, $em, $change_set);
|
||||
$args = new PreUpdateEventArgs($attention, $em, $change_set);
|
||||
$ul = new UpdateListener();
|
||||
static::assertFalse($ul->preUpdate($args));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user