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/
composer.lock
build/logs/
build/
build.xml

View File

@ -1,3 +1,8 @@
inherit: true
tools:
# @see https://scrutinizer-ci.com/docs/tools/php/security-advisory-checker/
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
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"?>
<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">
<delete dir="build/logs" verbose="true" />
<delete file="build/magento/app/etc/local.xml" verbose="true" />
</target>
<target name="prepare" depends="clean" hidden="true">
<mkdir dir="build/logs" />
</target>
<target name="build" depends="lint,phpunit" />
<target name="lint" depends="prepare">
<target name="lint">
<phplint>
<fileset dir="app/code/community/Bitpay/Bitcoins">
<include name="**/*.php"/>
@ -22,6 +45,38 @@
</target>
<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>
</project>

View File

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

View File

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