From 209510e970d3676f6d8986d7b12d6b26702d9939 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 1 Jul 2018 00:17:07 -0400 Subject: [PATCH] Replace PHP_EOL with \n to conform to code behavior on Windows in tests --- tests/ApiTest.php | 67 +++++++++++++++++++++++------------------------ 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/tests/ApiTest.php b/tests/ApiTest.php index 982f5bf11a..0d9e0b538b 100644 --- a/tests/ApiTest.php +++ b/tests/ApiTest.php @@ -481,7 +481,7 @@ class ApiTest extends DatabaseTest $this->app->query_string = 'api_path.rss'; $this->assertEquals( - ''.PHP_EOL. + ''."\n". 'some_data', api_call($this->app) ); @@ -505,7 +505,7 @@ class ApiTest extends DatabaseTest $this->app->query_string = 'api_path.atom'; $this->assertEquals( - ''.PHP_EOL. + ''."\n". 'some_data', api_call($this->app) ); @@ -571,14 +571,14 @@ class ApiTest extends DatabaseTest public function testApiErrorWithXml() { $this->assertEquals( - ''.PHP_EOL. + ''."\n". ''.PHP_EOL. - ' error_message'.PHP_EOL. - ' 200 Friendica\Network\HTTP'.PHP_EOL. - ' '.PHP_EOL. - ''.PHP_EOL, + 'xmlns:georss="http://www.georss.org/georss">'."\n". + ' error_message'."\n". + ' 200 Friendica\Network\HTTP'."\n". + ' '."\n". + ''."\n", api_error('xml', new HTTPException('error_message')) ); } @@ -591,14 +591,14 @@ class ApiTest extends DatabaseTest public function testApiErrorWithRss() { $this->assertEquals( - ''.PHP_EOL. + ''."\n". ''.PHP_EOL. - ' error_message'.PHP_EOL. - ' 200 Friendica\Network\HTTP'.PHP_EOL. - ' '.PHP_EOL. - ''.PHP_EOL, + 'xmlns:georss="http://www.georss.org/georss">'."\n". + ' error_message'."\n". + ' 200 Friendica\Network\HTTP'."\n". + ' '."\n". + ''."\n", api_error('rss', new HTTPException('error_message')) ); } @@ -611,14 +611,14 @@ class ApiTest extends DatabaseTest public function testApiErrorWithAtom() { $this->assertEquals( - ''.PHP_EOL. + ''."\n". ''.PHP_EOL. - ' error_message'.PHP_EOL. - ' 200 Friendica\Network\HTTP'.PHP_EOL. - ' '.PHP_EOL. - ''.PHP_EOL, + 'xmlns:georss="http://www.georss.org/georss">'."\n". + ' error_message'."\n". + ' 200 Friendica\Network\HTTP'."\n". + ' '."\n". + ''."\n", api_error('atom', new HTTPException('error_message')) ); } @@ -853,7 +853,6 @@ class ApiTest extends DatabaseTest $this->assertSelfUser(api_get_user($this->app, 0)); } - /** * Test the api_item_get_user() function. * @return void @@ -957,12 +956,12 @@ class ApiTest extends DatabaseTest public function testApiCreateXml() { $this->assertEquals( - ''.PHP_EOL. + ''."\n". ''.PHP_EOL. - ' some_data'.PHP_EOL. - ''.PHP_EOL, + 'xmlns:georss="http://www.georss.org/georss">'."\n". + ' some_data'."\n". + ''."\n", api_create_xml(['data' => ['some_data']], 'root_element') ); } @@ -974,10 +973,10 @@ class ApiTest extends DatabaseTest public function testApiCreateXmlWithoutNamespaces() { $this->assertEquals( - ''.PHP_EOL. - ''.PHP_EOL. - ' some_data'.PHP_EOL. - ''.PHP_EOL, + ''."\n". + ''."\n". + ' some_data'."\n". + ''."\n", api_create_xml(['data' => ['some_data']], 'ok') ); } @@ -999,12 +998,12 @@ class ApiTest extends DatabaseTest public function testApiFormatDataWithXml() { $this->assertEquals( - ''.PHP_EOL. + ''."\n". ''.PHP_EOL. - ' some_data'.PHP_EOL. - ''.PHP_EOL, + 'xmlns:georss="http://www.georss.org/georss">'."\n". + ' some_data'."\n". + ''."\n", api_format_data('root_element', 'xml', ['data' => ['some_data']]) ); } @@ -1963,7 +1962,7 @@ class ApiTest extends DatabaseTest ['id' => 2, 'screen_name' => 'recipient_name'], ['id' => 3, 'screen_name' => 'sender_name'] ); - $this->assertEquals('item_title'.PHP_EOL.'item_body', $result['text']); + $this->assertEquals('item_title'."\n".'item_body', $result['text']); $this->assertEquals(1, $result['id']); $this->assertEquals(2, $result['recipient_id']); $this->assertEquals(3, $result['sender_id']); -- 2.39.5