assertArrayHasKey( $meta_key, $registered ); } } /** * Ensure a plain http repository URL is rejected. */ public function test_project_links_reject_insecure_urls() { $term_id = self::factory()->term->create( array( 'taxonomy' => 'chrnx_project' ) ); update_term_meta( $term_id, 'chrnx_project_repo', 'http://example.com/repo' ); $this->assertArrayNotHasKey( 'repo', chrnx_get_project_links( $term_id ) ); } /** * Ensure stored https links come back keyed by their slot. */ public function test_project_links_return_stored_https_urls() { $term_id = self::factory()->term->create( array( 'taxonomy' => 'chrnx_project' ) ); update_term_meta( $term_id, 'chrnx_project_repo', 'https://github.com/Expressive-Tea/green-tea' ); update_term_meta( $term_id, 'chrnx_project_package', 'https://www.npmjs.com/package/@green-tea/core' ); $links = chrnx_get_project_links( $term_id ); $this->assertSame( 'https://github.com/Expressive-Tea/green-tea', $links['repo'] ); $this->assertSame( 'https://www.npmjs.com/package/@green-tea/core', $links['package'] ); $this->assertArrayNotHasKey( 'site', $links ); } }