Merge pull request #55 from JoshuaEstes/master

Continuous Integration
This commit is contained in:
Joshua Estes 2014-07-03 13:43:01 -04:00
commit b211d0dffa
11 changed files with 148 additions and 12 deletions

14
.gitattributes vendored Normal file
View File

@ -0,0 +1,14 @@
# These files are not included when making
# an archive of this repository.
/tests export-ignore
.coveralls.yml export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
build.properties
build.xml export-ignore
composer.json export-ignore
modman export-ignore
phpunit.xml.dist export-ignore
travis.properties

2
.gitignore vendored
View File

@ -4,3 +4,5 @@ bin/
vendor/ vendor/
composer.lock composer.lock
build/logs/ build/logs/
build/
build.xml

View File

@ -1,3 +1,8 @@
inherit: true inherit: true
tools: tools:
# @see https://scrutinizer-ci.com/docs/tools/php/security-advisory-checker/
sensiolabs_security_checker: true sensiolabs_security_checker: true
# @see https://scrutinizer-ci.com/docs/tools/php/php-analyzer/
php_analyzer: true
# @see https://scrutinizer-ci.com/docs/tools/php/pdepend/
php_pdepend: true

View File

@ -5,4 +5,8 @@ php:
- 5.3 - 5.3
install: install:
- composer install - composer install
script: php bin/phing script: php bin/phing -propertyfile travis.properties build-travis
cache:
directories:
- vendor
- build/magento

7
build.properties Normal file
View File

@ -0,0 +1,7 @@
# Running a build locally, this also is used
# to define all the default properties.
DB_USER=root
DB_PASS=root
DB_NAME=magento
DB_HOST=127.0.0.1
MAGENTO_VERSION=1.9.0.1

View File

@ -1,16 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project name="bitpay/magento-plugin" default="build"> <project name="bitpay/magento-plugin" default="build">
<!--
Default properties
-->
<property file="build.properties" />
<!--
Default build for running a build locally
-->
<target name="build" depends="lint,phpunit">
</target>
<!--
Used to run a build on Travis CI
-->
<target name="build-travis" depends="prepare">
<parallel threadCount="3">
<phingcall target="lint" />
<phingcall target="database:create" />
<phingcall target="magento:install" />
</parallel>
<phingcall target="phpunit" />
<phingcall target="coveralls" />
</target>
<target name="clean" hidden="true"> <target name="clean" hidden="true">
<delete dir="build/logs" verbose="true" /> <delete dir="build/logs" verbose="true" />
<delete file="build/magento/app/etc/local.xml" verbose="true" />
</target> </target>
<target name="prepare" depends="clean" hidden="true"> <target name="prepare" depends="clean" hidden="true">
<mkdir dir="build/logs" /> <mkdir dir="build/logs" />
</target> </target>
<target name="build" depends="lint,phpunit" /> <target name="lint">
<target name="lint" depends="prepare">
<phplint> <phplint>
<fileset dir="app/code/community/Bitpay/Bitcoins"> <fileset dir="app/code/community/Bitpay/Bitcoins">
<include name="**/*.php"/> <include name="**/*.php"/>
@ -22,6 +45,38 @@
</target> </target>
<target name="phpunit"> <target name="phpunit">
<phpunit printsummary="true" pharlocation="bin" /> <exec executable="bin/phpunit" passthru="true" />
</target>
<target name="coveralls">
<exec executable="bin/coveralls" passthru="true">
<arg value="-v" />
</exec>
</target>
<target name="database:create">
<exec executable="mysql" passthru="true">
<arg value="--user=${DB_USER}" />
<arg value="--password=${DB_PASS}" />
<arg value="-e" />
<arg value="create database ${DB_NAME};" />
</exec>
</target>
<target name="magento:install">
<exec executable="bin/n98-magerun" passthru="true" escape="true" level="debug">
<arg value="install" />
<arg value="-n" />
<arg value="--forceUseDb=${DB_NAME}" />
<arg value="--magentoVersion=${MAGENTO_VERSION}" />
<arg value="--installationFolder=build/magento" />
<arg value="--dbHost=${DB_HOST}" />
<arg value="--dbUser=${DB_USER}" />
<arg value="--dbPass=${DB_PASS}" />
<arg value="--dbName=${DB_NAME}" />
<arg value="--installSampleData=no" />
<arg value="--useDefaultConfigParams=yes" />
<arg value="--baseUrl=http://www.localhost.com" />
</exec>
</target> </target>
</project> </project>

View File

@ -17,7 +17,8 @@
"require-dev": { "require-dev": {
"phing/phing": "*", "phing/phing": "*",
"phpunit/phpunit": "*", "phpunit/phpunit": "*",
"satooshi/php-coveralls": "*" "satooshi/php-coveralls": "*",
"n98/magerun": "*"
}, },
"config": { "config": {
"bin-dir": "bin" "bin-dir": "bin"
@ -29,14 +30,16 @@
}, },
"archive": { "archive": {
"exclude": [ "exclude": [
"build.xml",
"build/",
"phpunit.xml.dist",
"tests/", "tests/",
".coveralls.yml", ".coveralls.yml",
".gitattributes",
".gitignore", ".gitignore",
".scrutinizer.yml", ".scrutinizer.yml",
".travis.yml" ".travis.yml",
"build.properties",
"build.xml",
"phpunit.xml.dist",
"travis.properties"
] ]
} }
} }

View File

@ -2,6 +2,7 @@
<phpunit <phpunit
backupGlobals = "false" backupGlobals = "false"
backupStaticAttributes = "false" backupStaticAttributes = "false"
bootstrap = "tests/bootstrap.php"
colors = "true" colors = "true"
convertErrorsToExceptions = "true" convertErrorsToExceptions = "true"
convertNoticesToExceptions = "true" convertNoticesToExceptions = "true"
@ -13,11 +14,18 @@
<testsuites> <testsuites>
<testsuite name="bitpay/magento-plugin Test Suite"> <testsuite name="bitpay/magento-plugin Test Suite">
<directory>tests/*Test.php</directory> <directory>tests/</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<filter>
<whitelist>
<directory>app/</directory>
<directory>lib/</directory>
</whitelist>
</filter>
<logging> <logging>
<log type="coverage-clover" target="build/logs/coverage.xml"/> <log type="coverage-clover" target="build/logs/clover.xml"/>
</logging> </logging>
</phpunit> </phpunit>

View File

@ -0,0 +1,28 @@
<?php
/**
* ©2011,2012,2013,2014 BITPAY, INC.
*
* Permission is hereby granted to any person obtaining a copy of this software
* and associated documentation for use and/or modification in association with
* the bitpay.com service.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* Bitcoin payment plugin using the bitpay.com service.
*/
class Bitpay_Bitcoins_Block_IframeTest extends PHPUnit_Framework_TestCase
{
public function testSomething()
{
$this->assertTrue(true);
}
}

4
tests/bootstrap.php Normal file
View File

@ -0,0 +1,4 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../build/magento/app/Mage.php';

6
travis.properties Normal file
View File

@ -0,0 +1,6 @@
# Properties file for running a build on Travis CI
DB_USER=travis
DB_PASS=
DB_NAME=magento
DB_HOST=127.0.0.1
MAGENTO_VERSION=1.9.0.1