@@ 2421-2445 (lines=25) @@ | ||
2418 | * |
|
2419 | * @group external-http |
|
2420 | */ |
|
2421 | public function test_twitter_card_with_redirect() { |
|
2422 | $urls = array( |
|
2423 | 'https://jetpack.me/', |
|
2424 | 'https://jetpack.com/', |
|
2425 | ); |
|
2426 | ||
2427 | $expected = array( |
|
2428 | 'https://jetpack.me/' => array( |
|
2429 | 'description' => 'The ultimate WordPress plugin for security, backups, malware scan, anti-spam, CDN, site search, CRM, Stripe, Facebook, & Instagram', |
|
2430 | 'image' => 'https://jetpackme.files.wordpress.com/2018/04/cropped-jetpack-favicon-2018.png?w=240', |
|
2431 | 'title' => 'Jetpack', |
|
2432 | 'type' => 'summary', |
|
2433 | ), |
|
2434 | 'https://jetpack.com/' => array( |
|
2435 | 'description' => 'The ultimate WordPress plugin for security, backups, malware scan, anti-spam, CDN, site search, CRM, Stripe, Facebook, & Instagram', |
|
2436 | 'image' => 'https://jetpackme.files.wordpress.com/2018/04/cropped-jetpack-favicon-2018.png?w=240', |
|
2437 | 'title' => 'Jetpack', |
|
2438 | 'type' => 'summary', |
|
2439 | ), |
|
2440 | ); |
|
2441 | ||
2442 | $cards = Jetpack_Tweetstorm_Helper::generate_cards( $urls ); |
|
2443 | ||
2444 | $this->assertEqualSetsWithIndex( $expected, $cards ); |
|
2445 | } |
|
2446 | ||
2447 | /** |
|
2448 | * Test that the return data is keyed by the URLs passed. |
|
@@ 2452-2478 (lines=27) @@ | ||
2449 | * |
|
2450 | * @group external-http |
|
2451 | */ |
|
2452 | public function test_twitter_cards_with_odd_URLs() { |
|
2453 | $urls = array( |
|
2454 | 'https://Jetpack.com/', |
|
2455 | 'https://jetpack.com', |
|
2456 | 'jetpack.com/', |
|
2457 | 'JETPACK.com', |
|
2458 | ); |
|
2459 | ||
2460 | $expected = array( |
|
2461 | 'https://Jetpack.com/' => array( |
|
2462 | 'description' => 'The ultimate WordPress plugin for security, backups, malware scan, anti-spam, CDN, site search, CRM, Stripe, Facebook, & Instagram', |
|
2463 | 'image' => 'https://jetpackme.files.wordpress.com/2018/04/cropped-jetpack-favicon-2018.png?w=240', |
|
2464 | 'title' => 'Jetpack', |
|
2465 | 'type' => 'summary', |
|
2466 | ), |
|
2467 | 'https://jetpack.com' => array( |
|
2468 | 'description' => 'The ultimate WordPress plugin for security, backups, malware scan, anti-spam, CDN, site search, CRM, Stripe, Facebook, & Instagram', |
|
2469 | 'image' => 'https://jetpackme.files.wordpress.com/2018/04/cropped-jetpack-favicon-2018.png?w=240', |
|
2470 | 'title' => 'Jetpack', |
|
2471 | 'type' => 'summary', |
|
2472 | ), |
|
2473 | ); |
|
2474 | ||
2475 | $cards = Jetpack_Tweetstorm_Helper::generate_cards( $urls ); |
|
2476 | ||
2477 | $this->assertEqualSetsWithIndex( $expected, $cards ); |
|
2478 | } |
|
2479 | } |
|
2480 |