Skip to content

Commit

Permalink
Use POST for all requests instead of GET (#27)
Browse files Browse the repository at this point in the history
* change all requests to use post instead of get

* confirm content-type header is set

* add performance tests back into travis

* try difference versions for prefer-lowest

* make expect Exception version generic

* fix prefer-lowest tests

* some timezone stuff

* ignore hhvm errors

* call child setUp, always use UTC in testing
  • Loading branch information
Harry Bragg authored Oct 16, 2017
1 parent 915aa4d commit b9392e8
Show file tree
Hide file tree
Showing 17 changed files with 1,761 additions and 299 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor/
composer.lock
/tests/report/
.idea
.DS_Store
18 changes: 16 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
language: php

dist: trusty

cache:
directories:
- $HOME/.composer/cache/files

php:
- 5.5
- 5.6
- 7.0
- 7.1
- hhvm
- nightly

env:
- PREFER_LOWEST=--prefer-lowest
- PREFER_LOWEST=

matrix:
allow_failures:
- php: nightly
- php: hhvm

before_script:
- travis_retry composer update --no-interaction
- travis_retry composer update --no-interaction --prefer-dist $PREFER_LOWEST

script:
- vendor/bin/phpcs -p --warning-severity=0 src/ tests/
- vendor/bin/phpunit --coverage-clover=./tests/report/coverage.clover --testsuite=coverage
- vendor/bin/phpunit --testsuite=performance

after_script:
- ./build/coverage_to_scruitinizer.sh
- test -f ./tests/report/coverage.clover && (wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover ./tests/report/coverage.clover)
68 changes: 37 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,66 +1,72 @@
SHELL = /bin/sh

DOCKER ?= $(shell which docker)
DOCKER_REPOSITORY := graze/php-alpine
VOLUME := /srv
VOLUME_MAP := -v $$(pwd):${VOLUME}
DOCKER_TAG := test
DOCKER_RUN_BASE := ${DOCKER} run --rm -t ${VOLUME_MAP} -w ${VOLUME}
DOCKER_RUN := ${DOCKER_RUN_BASE} ${DOCKER_REPOSITORY}:${DOCKER_TAG}
IMAGE ?= graze/php-alpine:test
DOCKER_RUN := ${DOCKER} run --rm -t -v $$(pwd):${VOLUME} -w ${VOLUME} ${IMAGE}

.PHONY: install composer clean help
.PHONY: test lint lint-fix test-unit test-integration test-matrix test-coverage test-coverage-html test-coverage-clover
PREFER_LOWEST ?=

.PHONY: build build-update composer-% clean help run
.PHONY: lint lint-fix
.PHONY: test test-unit test-integration test-lowest test-matrix test-coverage test-coverage-html test-coverage-clover

.SILENT: help
.DEFAULT_GOAL=help

# Building

install: ## Download the dependencies then build the image 🚀
make 'composer-install --optimize-autoloader --ignore-platform-reqs'
build: ## Download the dependencies then build the image :rocket:.
make 'composer-install --prefer-dist --optimize-autoloader'

build-update: ## Update all dependencies
make 'composer-update --prefer-dist --optimize-autoloader ${PREFER_LOWEST}'

composer-%: ## Run a composer command, `make "composer-<command> [...]"`.
${DOCKER} run -t --rm \
-v $$(pwd):/app \
-v ~/.composer:/root/composer \
-v ~/.ssh:/root/.ssh:ro \
composer/composer:alpine --ansi --no-interaction $* $(filter-out $@,$(MAKECMDGOALS))
-v ~/.composer:/tmp \
composer --ansi --no-interaction $* $(filter-out $@,$(MAKECMDGOALS))

# Testing

test: ## Run the unit and integration testsuites.
test: lint test-unit test-integration

lint: ## Run phpcs against the code.
$(DOCKER_RUN) vendor/bin/phpcs -p --warning-severity=0 src/ tests/
${DOCKER_RUN} vendor/bin/phpcs -p --warning-severity=0 src/ tests/

lint-fix: ## Run phpcsf and fix lint errors.
$(DOCKER_RUN) vendor/bin/phpcbf -p src/ tests/
lint-fix: ## Run phpcsf and fix possible lint errors.
${DOCKER_RUN} vendor/bin/phpcbf -p src/ tests/

test-unit: ## Run the unit testsuite.
$(DOCKER_RUN) vendor/bin/phpunit --colors=always --testsuite unit
${DOCKER_RUN} vendor/bin/phpunit --testsuite unit

test-matrix: ## Run the unit tests against multiple targets.
make DOCKER_RUN="${DOCKER_RUN_BASE} php:5.6-alpine" test
make DOCKER_RUN="${DOCKER_RUN_BASE} php:7.0-alpine" test
make DOCKER_RUN="${DOCKER_RUN_BASE} php:7.1-alpine" test
make DOCKER_RUN="${DOCKER_RUN_BASE} diegomarangoni/hhvm:cli" test
test-integration: ## Run the unit testsuite.
${DOCKER_RUN} vendor/bin/phpunit --testsuite integration

test-integration: ## Run the integration testsuite.
$(DOCKER_RUN) vendor/bin/phpunit --colors=always --testsuite integration
test-lowest: ## Test using the lowest possible versions of the dependencies
test-lowest: PREFER_LOWEST=--prefer-lowest --prefer-stable
test-lowest: build-update test

test-performance: ## Run the performance testsuite.
$(DOCKER_RUN) vendor/bin/phpunit --colors=always --testsuite performance
test-matrix: ## Run the unit tests against multiple targets.
${MAKE} IMAGE="php:5.6-alpine" test
${MAKE} IMAGE="php:7.0-alpine" test
${MAKE} IMAGE="php:7.1-alpine" test
${MAKE} IMAGE="hhvm/hhvm:latest" test

test-matrix-lowest: ## Run the unit tests against
${MAKE} build-update PREFER_LOWEST='--prefer-lowest --prefer-stable'
${MAKE} test-matrix
${MAKE} build-update

test-coverage: ## Run all tests and output coverage to the console.
$(DOCKER_RUN) phpdbg7 -qrr vendor/bin/phpunit --coverage-text --testsuite coverage
${DOCKER_RUN} phpdbg7 -qrr vendor/bin/phpunit --coverage-text

test-coverage-html: ## Run all tests and output html results
$(DOCKER_RUN) phpdbg7 -qrr vendor/bin/phpunit --coverage-html ./tests/report/html --testsuite coverage
test-coverage-html: ## Run all tests and output coverage to html.
${DOCKER_RUN} phpdbg7 -qrr vendor/bin/phpunit --coverage-html=./tests/report/html

test-coverage-clover: ## Run all tests and output clover coverage to file.
$(DOCKER_RUN) phpdbg7 -qrr vendor/bin/phpunit --coverage-clover=./tests/report/coverage.clover --testsuite coverage

${DOCKER_RUN} phpdbg7 -qrr vendor/bin/phpunit --coverage-clover=./tests/report/coverage.clover

# Help

Expand Down
9 changes: 0 additions & 9 deletions build/coverage_to_scruitinizer.sh

This file was deleted.

15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"description": "REST Client for Gigya API",
"keywords": [
"graze",
"gigya-client"
"gigya-client",
"gigya"
],
"homepage": "https://github.com/graze/gigya-client",
"license": "MIT",
Expand All @@ -21,15 +22,15 @@
}
],
"require": {
"php": ">=5.5.0",
"php": ">=5.5.0|^7.0",
"guzzlehttp/guzzle": "^6.2",
"illuminate/support": "^5.0",
"graze/standards": "^1.0"
"illuminate/support": "^5.0"
},
"require-dev": {
"phpunit/phpunit" : "^5",
"phpunit/phpunit": "^4.2 | ^5.2",
"mockery/mockery": "^0.9.4",
"squizlabs/php_codesniffer": "^2.3"
"squizlabs/php_codesniffer": "^3",
"graze/standards": "^2.0"
},
"autoload": {
"psr-4": {
Expand All @@ -40,7 +41,7 @@
"psr-4": {
"Graze\\Gigya\\Test\\": "tests/src",
"Graze\\Gigya\\Test\\Unit\\": "tests/unit",
"Graze\\Gigya\\Test\\Functional\\": "tests/functional",
"Graze\\Gigya\\Test\\Integration\\": "tests/integration",
"Graze\\Gigya\\Test\\Performance\\": "tests/performance"
}
}
Expand Down
Loading

0 comments on commit b9392e8

Please sign in to comment.