db = new PDO('sqlite::memory:', options: [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ]); $this->db->sqliteCreateFunction('strip_tags', 'strip_tags', 1); Migrator::run($this->db); $this->db->exec("INSERT INTO users (id, username, email, password_hash, role, created_at) VALUES (1, 'alice', 'alice@example.com', 'hash', 'user', '2024-01-01 00:00:00')"); $this->db->exec("INSERT INTO posts (id, title, content, slug, author_id, created_at, updated_at) VALUES (1, 'Guide Slim', '
Contenu
', 'guide-slim', 1, '2024-01-01 00:00:00', '2024-01-01 00:00:00')"); } public function testSearchReflectsUpdatedAuthorUsernameInFtsIndex(): void { $this->db->exec("UPDATE users SET username = 'alice_renamed' WHERE id = 1"); $results = (new PdoPostRepository($this->db))->search('alice_renamed'); self::assertCount(1, $results); self::assertSame('alice_renamed', $results[0]->getAuthorUsername()); self::assertSame('Guide Slim', $results[0]->getTitle()); } }