array( 'wpdo_hpct_imported' ), ); public function test_core_code_does_not_mention_hpct(): void { $root = dirname( __DIR__, 2 ); $offences = array(); foreach ( array( 'includes', 'cli', 'admin' ) as $dir ) { $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator( $root . '/' . $dir, FilesystemIterator::SKIP_DOTS ) ); foreach ( $files as $file ) { if ( 'php' !== $file->getExtension() ) { continue; } $rel = substr( $file->getPathname(), strlen( $root ) + 1 ); $code = ''; foreach ( token_get_all( (string) file_get_contents( $file->getPathname() ) ) as $token ) { if ( is_array( $token ) && in_array( $token[0], array( T_COMMENT, T_DOC_COMMENT ), true ) ) { continue; } $code .= is_array( $token ) ? $token[1] : $token; } $code = str_replace( self::ALLOWED[ $rel ] ?? array(), '', $code ); if ( preg_match_all( '/\w*hpct\w*/i', $code, $m ) ) { $offences[] = $rel . ': ' . implode( ', ', array_unique( $m[0] ) ); } } } $this->assertSame( array(), $offences, "HPCT legacy left in core:\n" . implode( "\n", $offences ) ); } public function test_only_live_addon_modules_remain_besides_zone_modules(): void { $this->assertSame( array( 'wc_orders', 'latepoint' ), TMDO_Feature_Flags::ADDON_MODULES ); $GLOBALS['_wp_options'] = array(); $ref = new ReflectionProperty( TMDO_Feature_Flags::class, 'cache' ); $ref->setAccessible( true ); $ref->setValue( null, null ); $modules = array_keys( TMDO_Feature_Flags::all() ); foreach ( array( 'reviews', 'messages', 'favorites', 'memberships', 'statistics', 'requests', 'listing_meta' ) as $gone ) { $this->assertNotContains( $gone, $modules ); } } }