@@ 2404-2428 (lines=25) @@ | ||
2401 | * |
|
2402 | * @group external-http |
|
2403 | */ |
|
2404 | public function test_twitter_card_with_redirect() { |
|
2405 | $urls = array( |
|
2406 | 'https://jetpack.me/', |
|
2407 | 'https://jetpack.com/', |
|
2408 | ); |
|
2409 | ||
2410 | $expected = array( |
|
2411 | 'https://jetpack.me/' => array( |
|
2412 | 'description' => 'The ultimate WordPress plugin for security, backups, malware scan, anti-spam, CDN, site search, CRM, Stripe, Facebook, & Instagram', |
|
2413 | 'image' => 'https://jetpackme.files.wordpress.com/2018/04/cropped-jetpack-favicon-2018.png?w=240', |
|
2414 | 'title' => 'Jetpack', |
|
2415 | 'type' => 'summary', |
|
2416 | ), |
|
2417 | 'https://jetpack.com/' => array( |
|
2418 | 'description' => 'The ultimate WordPress plugin for security, backups, malware scan, anti-spam, CDN, site search, CRM, Stripe, Facebook, & Instagram', |
|
2419 | 'image' => 'https://jetpackme.files.wordpress.com/2018/04/cropped-jetpack-favicon-2018.png?w=240', |
|
2420 | 'title' => 'Jetpack', |
|
2421 | 'type' => 'summary', |
|
2422 | ), |
|
2423 | ); |
|
2424 | ||
2425 | $cards = Jetpack_Tweetstorm_Helper::generate_cards( $urls ); |
|
2426 | ||
2427 | $this->assertEqualSetsWithIndex( $expected, $cards ); |
|
2428 | } |
|
2429 | ||
2430 | /** |
|
2431 | * Test that the return data is keyed by the URLs passed. |
|
@@ 2435-2461 (lines=27) @@ | ||
2432 | * |
|
2433 | * @group external-http |
|
2434 | */ |
|
2435 | public function test_twitter_cards_with_odd_URLs() { |
|
2436 | $urls = array( |
|
2437 | 'https://Jetpack.com/', |
|
2438 | 'https://jetpack.com', |
|
2439 | 'jetpack.com/', |
|
2440 | 'JETPACK.com', |
|
2441 | ); |
|
2442 | ||
2443 | $expected = array( |
|
2444 | 'https://Jetpack.com/' => array( |
|
2445 | 'description' => 'The ultimate WordPress plugin for security, backups, malware scan, anti-spam, CDN, site search, CRM, Stripe, Facebook, & Instagram', |
|
2446 | 'image' => 'https://jetpackme.files.wordpress.com/2018/04/cropped-jetpack-favicon-2018.png?w=240', |
|
2447 | 'title' => 'Jetpack', |
|
2448 | 'type' => 'summary', |
|
2449 | ), |
|
2450 | 'https://jetpack.com' => array( |
|
2451 | 'description' => 'The ultimate WordPress plugin for security, backups, malware scan, anti-spam, CDN, site search, CRM, Stripe, Facebook, & Instagram', |
|
2452 | 'image' => 'https://jetpackme.files.wordpress.com/2018/04/cropped-jetpack-favicon-2018.png?w=240', |
|
2453 | 'title' => 'Jetpack', |
|
2454 | 'type' => 'summary', |
|
2455 | ), |
|
2456 | ); |
|
2457 | ||
2458 | $cards = Jetpack_Tweetstorm_Helper::generate_cards( $urls ); |
|
2459 | ||
2460 | $this->assertEqualSetsWithIndex( $expected, $cards ); |
|
2461 | } |
|
2462 | } |
|
2463 |