Skip to content

Commit

Permalink
Fix returned header key to lower case (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
janette authored Jan 9, 2023
1 parent 30aa164 commit 21a47f6
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 45 deletions.
38 changes: 19 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions .ddev/config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/vendor/
composer.lock
.idea

.phpunit.result.cache
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
29 changes: 12 additions & 17 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
verbose="false">

<testsuites>
<testsuite name="all">
<directory suffix="Test.php" phpVersion="7.2" phpVersionOperator=">=">test</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>

<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" verbose="false">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="all">
<directory suffix="Test.php" phpVersion="7.2" phpVersionOperator="&gt;=">test</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion src/Processor/Remote.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions test/Processor/RemoteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 21a47f6

Please sign in to comment.