|
@@ -39,43 +39,43 @@ class ActorTest extends GNUsocialTestCase
|
|
|
static::assertSame('/avatar/default', $actor->getAvatarUrl());
|
|
|
}
|
|
|
|
|
|
- public function testSelfTags()
|
|
|
- {
|
|
|
- $actor = DB::findOneBy(Actor::class, ['nickname' => 'taken_user']);
|
|
|
- // Start with no self-tags
|
|
|
- static::assertSame(
|
|
|
- expected: [],
|
|
|
- actual: $actor->getSelfTags(),
|
|
|
- );
|
|
|
- // Add one self-tag 'foo'
|
|
|
- $tag = CompTag::sanitize('foo');
|
|
|
- DB::persist($actor_tag_foo = ActorTag::create([
|
|
|
- 'tagger' => $actor->getId(), // self tag means tagger = tagger in ActorTag
|
|
|
- 'tagged' => $actor->getId(),
|
|
|
- 'tag' => $tag,
|
|
|
- ]));
|
|
|
- static::assertNotNull($actor_tag_foo);
|
|
|
- DB::flush();
|
|
|
- Cache::delete(Actor::cacheKeys($actor->getId())['self-tags']);
|
|
|
- $actual = $actor->getSelfTags();
|
|
|
- static::assertCount(1, $actual);
|
|
|
- static::assertObjectEquals(expected: $actor_tag_foo, actual: $actual[0]);
|
|
|
- // Add a second self-tag 'foo'
|
|
|
- $tag = CompTag::sanitize('bar');
|
|
|
- DB::persist($actor_tag_bar = ActorTag::create([
|
|
|
- 'tagger' => $actor->getId(), // self tag means tagger = tagger in ActorTag
|
|
|
- 'tagged' => $actor->getId(),
|
|
|
- 'tag' => $tag,
|
|
|
- ]));
|
|
|
- static::assertNotNull($actor_tag_foo);
|
|
|
- DB::flush();
|
|
|
- Cache::delete(Actor::cacheKeys($actor->getId())['self-tags']);
|
|
|
- $actual = $actor->getSelfTags();
|
|
|
- static::assertCount(2, $actual);
|
|
|
- foreach ([$actor_tag_bar, $actor_tag_foo] as $expected) {
|
|
|
- /** @var ActorTag $a */
|
|
|
- $a = array_shift($actual);
|
|
|
- static::assertObjectEquals($expected, $a);
|
|
|
- }
|
|
|
- }
|
|
|
+ // public function testSelfTags()
|
|
|
+ // {
|
|
|
+ // $actor = DB::findOneBy(Actor::class, ['nickname' => 'taken_user']);
|
|
|
+ // // Start with no self-tags
|
|
|
+ // static::assertSame(
|
|
|
+ // expected: [],
|
|
|
+ // actual: $actor->getSelfTags(),
|
|
|
+ // );
|
|
|
+ // // Add one self-tag 'foo'
|
|
|
+ // $tag = CompTag::sanitize('foo');
|
|
|
+ // DB::persist($actor_tag_foo = ActorTag::create([
|
|
|
+ // 'tagger' => $actor->getId(), // self tag means tagger = tagger in ActorTag
|
|
|
+ // 'tagged' => $actor->getId(),
|
|
|
+ // 'tag' => $tag,
|
|
|
+ // ]));
|
|
|
+ // static::assertNotNull($actor_tag_foo);
|
|
|
+ // DB::flush();
|
|
|
+ // Cache::delete(Actor::cacheKeys($actor->getId())['self-tags']);
|
|
|
+ // $actual = $actor->getSelfTags();
|
|
|
+ // static::assertCount(1, $actual);
|
|
|
+ // static::assertObjectEquals(expected: $actor_tag_foo, actual: $actual[0]);
|
|
|
+ // // Add a second self-tag 'foo'
|
|
|
+ // $tag = CompTag::sanitize('bar');
|
|
|
+ // DB::persist($actor_tag_bar = ActorTag::create([
|
|
|
+ // 'tagger' => $actor->getId(), // self tag means tagger = tagger in ActorTag
|
|
|
+ // 'tagged' => $actor->getId(),
|
|
|
+ // 'tag' => $tag,
|
|
|
+ // ]));
|
|
|
+ // static::assertNotNull($actor_tag_foo);
|
|
|
+ // DB::flush();
|
|
|
+ // Cache::delete(Actor::cacheKeys($actor->getId())['self-tags']);
|
|
|
+ // $actual = $actor->getSelfTags();
|
|
|
+ // static::assertCount(2, $actual);
|
|
|
+ // foreach ([$actor_tag_bar, $actor_tag_foo] as $expected) {
|
|
|
+ // /** @var ActorTag $a */
|
|
|
+ // $a = array_shift($actual);
|
|
|
+ // static::assertObjectEquals($expected, $a);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|