From aa82ca9f4247570eb637dcaf99ec68048f7edab5 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 12 Feb 2021 20:29:07 -0800 Subject: [PATCH] HttpTestTrait - assertContentType() should a little sensitive to CMS variations This is based on the observation the WP reported `text/plain` while D7 reported `text/plain;charset=UTF-8` -- even though the Civi output logic was the same (specifying `text/plain`). --- Civi/Test/HttpTestTrait.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Civi/Test/HttpTestTrait.php b/Civi/Test/HttpTestTrait.php index cdc42c64de..1e3fc71f6e 100644 --- a/Civi/Test/HttpTestTrait.php +++ b/Civi/Test/HttpTestTrait.php @@ -130,9 +130,9 @@ trait HttpTestTrait { */ protected function assertContentType($expectType, $response = NULL) { $response = $this->resolveResponse($response); - $actualType = $response->getHeader('Content-Type'); + list($actualType) = explode(';', $response->getHeader('Content-Type')[0]); $fmt = $actualType === $expectType ? '' : $this->formatFailure($response); - $this->assertEquals([$expectType], $actualType, "Expected content-type $expectType. Received conte-tntype $actualType.\n$fmt"); + $this->assertEquals($expectType, $actualType, "Expected content-type $expectType. Received conte-tntype $actualType.\n$fmt"); return $this; } -- 2.25.1