Skip to content

Commit

Permalink
Add CircleCI config
Browse files Browse the repository at this point in the history
- Add CircleCI config to run linting (php_codesniffer)
  and tests (PHPUnit)
  - Fix linting issue with docblock line length
- Correct version of phpunit/phpunit
  (tests were using namespaced TestCase which is available since 6.0)
- Change autoloading to PSR-4 (no change to how classes are used)
- Add Composer scripts
  • Loading branch information
mrliptontea committed May 10, 2024
1 parent c834ae5 commit d530b53
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 15 deletions.
39 changes: 39 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: 2.1

jobs:
lint:
docker:
- image: cimg/php:7.4
steps:
- checkout
- run: composer install
- run: composer lint -- --report=full --report-junit=php_codesniffer-junit.xml
- store_test_results:
path: php_codesniffer-junit.xml
- store_artifacts:
path: php_codesniffer-junit.xml

test:
parameters:
php_version:
type: string
docker:
- image: cimg/php:<< parameters.php_version >>
steps:
- checkout
- run: composer install
- run: composer test -- --log-junit phpunit-junit.xml
- store_test_results:
path: phpunit-junit.xml
- store_artifacts:
path: phpunit-junit.xml

workflows:
build_and_test:
jobs:
- lint
- test:
matrix:
parameters:
php_version:
- 7.4
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

.vscode/
.idea/
atlassian-ide-plugin.xml
vendor/
composer.phar
composer.lock
*-junit.xml
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
},
"require-dev": {
"squizlabs/php_codesniffer": "3.*",
"phpunit/phpunit": "4.8.36",
"phpunit/phpunit": "^6.5.14",
"pear/file_marc": "1.1.2"
},
"autoload":{
"psr-0": {
"SRU": "src"
"psr-4": {
"SRU\\": "src/SRU/"
}
},
"scripts": {
"lint": "phpcs --standard=PSR2 src",
"test": "phpunit"
}
}
}
3 changes: 2 additions & 1 deletion src/SRU/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ public function search($query, $options = [], $raw = false)
* Performs a searchRetrieve operation and returns a SearchRetrieveResponse object or a string is $raw is true
*
* @param string $query The CQL query string
* @param array $options The query options ('version', 'maximumRecords', 'startRecord', 'recordSchema', 'recordPacking')
* @param array $options The query options
* ('version', 'maximumRecords', 'startRecord', 'recordSchema', 'recordPacking')
* @param bool $raw If true, returns the response as a string
* @return SearchRetrieveResponse|string
*/
Expand Down

0 comments on commit d530b53

Please sign in to comment.