From 21a47f681cd9311af6636c4716f366ac0bb164f7 Mon Sep 17 00:00:00 2001 From: Janette Day Date: Mon, 9 Jan 2023 14:38:06 -0600 Subject: [PATCH] Fix returned header key to lower case (#27) --- .circleci/config.yml | 38 +++++++++++++++++------------------ .ddev/config.yaml | 6 +++--- .gitignore | 2 +- composer.json | 2 +- phpunit.xml | 29 +++++++++++--------------- src/Processor/Remote.php | 2 +- test/Processor/RemoteTest.php | 5 ++--- 7 files changed, 39 insertions(+), 45 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c878298..f13e205 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,29 +1,29 @@ -version: 2.0 +version: 2.1 jobs: - build: - machine: - image: ubuntu-2004:202010-01 - environment: - CC_TEST_REPORTER_ID: 05b97154cabfafb769fb0afb99744dca1b5b1bdc6436657c0ac32887cfa599da - working_directory: ~/repo + test: + docker: + - image: cimg/php:8.0 steps: - checkout - run: - name: Setup DDEV - command: | - curl -LO https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh && bash install_ddev.sh + name: composer install + command: composer install - run: name: Setup Code Climate test-reporter command: | curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter chmod +x ./cc-test-reporter - - run: - name: Run tests - command: | - ddev start - ddev xdebug - ddev composer install ./cc-test-reporter before-build - ddev exec ./vendor/bin/phpunit --testsuite all --coverage-clover clover.xml - sed -i 's+/var/www/html/+/home/circleci/repo/+g' clover.xml - ./cc-test-reporter after-build --coverage-input-type clover --exit-code $? + - run: + name: PHPUnit Tests + environment: + XDEBUG_MODE: coverage + command: phpdbg -qrr vendor/bin/phpunit --coverage-clover clover.xml + - run: + name: Report test coverage + command: ./cc-test-reporter after-build --coverage-input-type clover --exit-code $? + +workflows: + test-workflow: + jobs: + - test diff --git a/.ddev/config.yaml b/.ddev/config.yaml index 537fd0d..7ceeb62 100644 --- a/.ddev/config.yaml +++ b/.ddev/config.yaml @@ -1,18 +1,18 @@ name: file-fetcher type: php docroot: "" -php_version: "7.3" +php_version: "8.0" webserver_type: nginx-fpm router_http_port: "80" router_https_port: "443" xdebug_enabled: false additional_hostnames: [] additional_fqdns: [] -mariadb_version: "10.2" +mariadb_version: "10.4" mysql_version: "" provider: default use_dns_when_possible: true -composer_version: "" +composer_version: "2" # This config.yaml was created with ddev version v1.16.5 diff --git a/.gitignore b/.gitignore index 2d3db74..3d68ae0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /vendor/ composer.lock .idea - +.phpunit.result.cache diff --git a/composer.json b/composer.json index 61fb9d8..6f1747e 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "license": "GPL-3.0-only", "minimum-stability": "dev", "require-dev": { - "phpunit/phpunit": "^8.2", + "phpunit/phpunit": "^9.0", "getdkan/mock-chain": "dev-master" }, "authors": [ diff --git a/phpunit.xml b/phpunit.xml index b4d7c1e..444f5b1 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,18 +1,13 @@ - - - - - test - - - - - - src - - - + + + + + src + + + + + test + + diff --git a/src/Processor/Remote.php b/src/Processor/Remote.php index cc3607d..27795ab 100644 --- a/src/Processor/Remote.php +++ b/src/Processor/Remote.php @@ -9,7 +9,7 @@ class Remote extends AbstractChunkedProcessor protected function getFileSize(string $filePath): int { $headers = $this->getHeaders($filePath); - return $headers['Content-Length']; + return $headers['content-length']; } public function isServerCompatible(array $state): bool diff --git a/test/Processor/RemoteTest.php b/test/Processor/RemoteTest.php index b688cc0..68cfd6b 100644 --- a/test/Processor/RemoteTest.php +++ b/test/Processor/RemoteTest.php @@ -37,9 +37,8 @@ public function testCopyAFileWithRemoteProcessor() $state = $fetcher->getState(); $this->assertTrue(true); - - - unlink($state['destination']); + $this->assertEquals($state['processor'], 'FileFetcherTests\Mock\FakeRemote'); + $this->assertEquals($state['destination'], 'http://notreal.blah/notacsv.csv'); } public function testCurlCopy()