diff --git a/.travis.yml b/.travis.yml index c6b2e41..971a342 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,7 @@ language: php sudo: required dist: trusty php: - - 5.6 - - 7.0 + - 7.1 before_script: # some useful debugging stuff for travis #- curl http://magento-2-travis.dev/index.php @@ -91,6 +90,21 @@ before_script: # test that magento is installed - curl "$PULSESTORM_MAGE2_FAKE_URL/index.php" - pestle.phar hello_world + # phpcs install and generating a module for same + + # generate the code for phpcs + - ../travis/for-lint.sh + + # leave m2 folder + - cd .. + + # install phpcs + - mkdir phpcs/ + - cd phpcs/ + - echo "{}" > composer.json + - composer require magento/magento-coding-standard -vvv + + # return to the base folder and composer install pestle - cd .. - composer install script: @@ -99,3 +113,7 @@ script: # integration tests - cd magento2 - vendor/bin/phpunit vendor/pulsestorm/pestle/tests-integration + # run phpcs + - cd ../phpcs + - find ../magento2/app/code/Pulsestorm + - vendor/bin/phpcs vendor/bin/phpcs --standard=vendor/magento/magento-coding-standard/Magento2/ ../magento2/app/code/Pulsestorm/Travis diff --git a/composer.json b/composer.json index 20e60a0..2727765 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,8 @@ "require-dev": { "phpunit/phpunit": "4.8.*", "phing/phing": "2.*", - "phpspec/prophecy":"1.7.0" + "phpspec/prophecy":"1.7.0", + "magento/magento-coding-standard": "^4.0" }, "autoload": { "files": ["library/autoload.php"] diff --git a/composer.lock b/composer.lock index 385dc84..bcb1f06 100644 --- a/composer.lock +++ b/composer.lock @@ -1,10 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f7e992f30f75f6df9ac92aad130d4a36", + "content-hash": "31a780b3bc8f6061e1d5c11032d74538", "packages": [ { "name": "abraham/twitteroauth", @@ -886,6 +886,36 @@ ], "time": "2015-06-14T21:17:01+00:00" }, + { + "name": "magento/magento-coding-standard", + "version": "4", + "source": { + "type": "git", + "url": "https://github.com/magento/magento-coding-standard.git", + "reference": "d24e0230a532e19941ed264f57db38fad5b1008a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/magento/magento-coding-standard/zipball/d24e0230a532e19941ed264f57db38fad5b1008a", + "reference": "d24e0230a532e19941ed264f57db38fad5b1008a", + "shasum": "" + }, + "require": { + "php": ">=5.6.0", + "squizlabs/php_codesniffer": "^3.4" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "description": "A set of Magento specific PHP CodeSniffer rules.", + "time": "2019-08-06T15:58:37+00:00" + }, { "name": "phing/phing", "version": "2.16.0", @@ -1562,6 +1592,7 @@ "mock", "xunit" ], + "abandoned": true, "time": "2015-10-02T06:51:40+00:00" }, { @@ -1936,6 +1967,57 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21T13:59:46+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.4.2", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", + "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2019-04-10T23:49:02+00:00" + }, { "name": "symfony/yaml", "version": "v3.3.13", diff --git a/travis/for-lint.sh b/travis/for-lint.sh new file mode 100755 index 0000000..64ae6df --- /dev/null +++ b/travis/for-lint.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +## Our travis CI/CD will run this script from the root of a Magento +## folder. Put pestle commands here to generate code in the +## Pulsestorm_Travis module. At the end of the CI we'll run phpcs +## against this folder to ensure generate code + + +## putting some basic files in place so we can merge and tackle +## the "phpcs-ification" of things in stages +mkdir -p app/code/Pulsestorm/Travis +printf " app/code/Pulsestorm/Travis/Test.php + +# pestle.phar magento2:generate:crud-model Pulsestorm_Travis Thing