wordpress-activitypub/tests/test-class-activitypub-user.php
Matthias Pfefferle 79f400d88a
Improve User management (#703)
* Use an ActivityPub capability to better enable/disable ActivityPub support

* split PRs

* remove test hook

* do not run migrations for new installs

* fix unit tests

* fix unit tests

* remove abandoned schedule!

* fix migration class

* fix order

* restructuring

* remove follower migration

* do not yet remove legacy followers

* remove blog-user changes

* use a const for the version number

* add user tests and fix old ones

* use a more generic async migrator

* optimized test
2024-03-11 15:19:07 +01:00

33 lines
798 B
PHP

<?php
class Test_Activitypub_User extends WP_UnitTestCase {
public function test_activitypub_cap() {
$userdata = array(
'user_email' => 'subscriber@example.com',
'first_name' => 'Max',
'last_name' => 'Mustermann',
'user_login' => 'subscriber',
'user_pass' => 'subscriber',
'role' => 'subscriber',
);
$user_id = wp_insert_user( $userdata );
$can = user_can( $user_id, 'activitypub' );
$this->assertFalse( $can );
$userdata = array(
'user_email' => 'editor@example.com',
'first_name' => 'Max',
'last_name' => 'Mustermann',
'user_login' => 'editor',
'user_pass' => 'editor',
'role' => 'editor',
);
$user_id = wp_insert_user( $userdata );
$can = user_can( $user_id, 'activitypub' );
$this->assertTrue( $can );
}
}