| | 1134 | |
| | 1135 | /** |
| | 1136 | * @group bbg |
| | 1137 | */ |
| | 1138 | public function test_xprofile_data_should_be_deleted_on_user_delete_non_multisite() { |
| | 1139 | if ( is_multisite() ) { |
| | 1140 | $this->markTestSkipped( __METHOD__ . ' requires non-multisite.' ); |
| | 1141 | } |
| | 1142 | |
| | 1143 | $u = self::factory()->user->create(); |
| | 1144 | |
| | 1145 | $fg = self::factory()->xprofile_group->create(); |
| | 1146 | $f1 = self::factory()->xprofile_field->create( |
| | 1147 | array( |
| | 1148 | 'field_group_id' => $fg, |
| | 1149 | ) |
| | 1150 | ); |
| | 1151 | |
| | 1152 | xprofile_set_field_data( $f1, $u, 'foo' ); |
| | 1153 | $this->assertSame( 'foo', xprofile_get_field_data( $f1, $u ) ); |
| | 1154 | |
| | 1155 | wp_delete_user( $u ); |
| | 1156 | |
| | 1157 | $this->assertSame( '', xprofile_get_field_data( $f1, $u ) ); |
| | 1158 | } |
| | 1159 | |
| | 1160 | /** |
| | 1161 | * @group bbg |
| | 1162 | */ |
| | 1163 | public function test_xprofile_data_should_be_deleted_on_user_delete_multisite() { |
| | 1164 | if ( ! is_multisite() ) { |
| | 1165 | $this->markTestSkipped( __METHOD__ . ' requires multisite.' ); |
| | 1166 | } |
| | 1167 | |
| | 1168 | $u = self::factory()->user->create(); |
| | 1169 | |
| | 1170 | $fg = self::factory()->xprofile_group->create(); |
| | 1171 | $f1 = self::factory()->xprofile_field->create( |
| | 1172 | array( |
| | 1173 | 'field_group_id' => $fg, |
| | 1174 | ) |
| | 1175 | ); |
| | 1176 | |
| | 1177 | xprofile_set_field_data( $f1, $u, 'foo' ); |
| | 1178 | $this->assertSame( 'foo', xprofile_get_field_data( $f1, $u ) ); |
| | 1179 | |
| | 1180 | wpmu_delete_user( $u ); |
| | 1181 | |
| | 1182 | $this->assertSame( '', xprofile_get_field_data( $f1, $u ) ); |
| | 1183 | } |
| | 1184 | |
| | 1185 | /** |
| | 1186 | * @group bbg |
| | 1187 | */ |
| | 1188 | public function test_xprofile_data_should_not_be_deleted_on_wp_delete_user_multisite() { |
| | 1189 | if ( ! is_multisite() ) { |
| | 1190 | $this->markTestSkipped( __METHOD__ . ' requires multisite.' ); |
| | 1191 | } |
| | 1192 | |
| | 1193 | $u = self::factory()->user->create(); |
| | 1194 | |
| | 1195 | $fg = self::factory()->xprofile_group->create(); |
| | 1196 | $f1 = self::factory()->xprofile_field->create( |
| | 1197 | array( |
| | 1198 | 'field_group_id' => $fg, |
| | 1199 | ) |
| | 1200 | ); |
| | 1201 | |
| | 1202 | xprofile_set_field_data( $f1, $u, 'foo' ); |
| | 1203 | $this->assertSame( 'foo', xprofile_get_field_data( $f1, $u ) ); |
| | 1204 | |
| | 1205 | wp_delete_user( $u ); |
| | 1206 | var_Dump( BP_PLUGIN_DIR ); |
| | 1207 | |
| | 1208 | $this->assertSame( 'foo', xprofile_get_field_data( $f1, $u ) ); |
| | 1209 | } |