mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-04-08 11:31:59 +00:00
Update travis config for run tests
This commit is contained in:
parent
c0fbb05e4f
commit
ad60c20cf9
7 changed files with 53 additions and 19 deletions
31
.travis.yml
31
.travis.yml
|
@ -4,23 +4,34 @@ sudo: false
|
|||
|
||||
php:
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
|
||||
env:
|
||||
global:
|
||||
- DB_USER=root
|
||||
- DB_HOST=localhost
|
||||
- DB_NAME=test_prestashop
|
||||
matrix:
|
||||
include:
|
||||
- php: 5.3
|
||||
dist: precise
|
||||
env: BRANCH=1.6.1.x
|
||||
- php: 5.4
|
||||
env: BRANCH=1.6.1.x
|
||||
- php: 5.5
|
||||
env: BRANCH=1.6.1.x
|
||||
- php: 5.6
|
||||
env: BRANCH=1.6.1.x
|
||||
- php: 7.0
|
||||
env: BRANCH=1.6.1.x
|
||||
- php: 7.1
|
||||
env: BRANCH=1.6.1.x
|
||||
- php: 7.2
|
||||
env: BRANCH=1.6.1.x
|
||||
|
||||
before_script:
|
||||
- bash tests/bin/clone_prestashop.sh
|
||||
- cd ../PrestaShop
|
||||
- cp tests/parameters.yml.travis app/config/parameters.yml
|
||||
- bash travis-scripts/install-prestashop
|
||||
- bash tests/bin/before_script.sh
|
||||
|
||||
script:
|
||||
- cd $TRAVIS_BUILD_DIR
|
||||
- bash tests/bin/script.sh
|
||||
- php ../PrestaShop/vendor/bin/phpunit -c phpunit.xml.dist
|
||||
|
||||
deploy:
|
||||
skip_cleanup: true
|
||||
|
|
|
@ -580,7 +580,7 @@ class RetailCRM extends Module
|
|||
} else {
|
||||
$paymentCode = $params['order']->payment;
|
||||
}
|
||||
var_dump($paymentCode);
|
||||
|
||||
if ($this->apiVersion != 5) {
|
||||
if (array_key_exists($paymentCode, $payment) && !empty($payment[$paymentCode])) {
|
||||
$order['paymentType'] = $payment[$paymentCode];
|
||||
|
|
11
tests/bin/before_script.sh
Normal file
11
tests/bin/before_script.sh
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z $TRAVIS_BUILD_DIR ]; then
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
PRESTASHOP_DIR=$TRAVIS_BUILD_DIR/../PrestaShop
|
||||
|
||||
cd $PRESTASHOP_DIR
|
||||
cp tests/parameters.yml.travis app/config/parameters.yml
|
||||
bash travis-scripts/install-prestashop
|
|
@ -12,6 +12,8 @@ cd PrestaShop
|
|||
|
||||
if ! [ -z $BRANCH ]; then
|
||||
git checkout $BRANCH;
|
||||
cd tests
|
||||
composer install
|
||||
else
|
||||
composer install --prefer-dist --no-interaction --no-progress
|
||||
fi
|
||||
|
|
|
@ -6,5 +6,10 @@ fi
|
|||
|
||||
PRESTASHOP_DIR=$TRAVIS_BUILD_DIR/../PrestaShop
|
||||
|
||||
cd $PRESTASHOP_DIR
|
||||
composer run-script create-test-db --timeout=0
|
||||
if ! [ -z $BRANCH ]; then
|
||||
phpunit
|
||||
else
|
||||
cd $PRESTASHOP_DIR
|
||||
composer run-script create-test-db --timeout=0
|
||||
php ../PrestaShop/vendor/bin/phpunit -c $TRAVIS_BUILD_DIR/phpunit.xml.dist
|
||||
fi
|
||||
|
|
|
@ -8,8 +8,10 @@ abstract class RetailcrmTestCase extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
$contextMocker = new \Tests\Unit\ContextMocker();
|
||||
$this->contextMock = $contextMocker->mockContext();
|
||||
if (version_compare(_PS_VERSION_, '1.7', '>')) {
|
||||
$contextMocker = new \Tests\Unit\ContextMocker();
|
||||
$this->contextMock = $contextMocker->mockContext();
|
||||
}
|
||||
}
|
||||
|
||||
protected function setConfig()
|
||||
|
|
|
@ -24,10 +24,13 @@ class RetailcrmReferencesTest extends RetailcrmTestCase
|
|||
public function testGetSystemPaymentModules()
|
||||
{
|
||||
$this->assertInternalType('array', $this->retailcrmReferences->payment_modules);
|
||||
$this->assertNotEmpty($this->retailcrmReferences->payment_modules);
|
||||
$this->assertArrayHasKey('name', $this->retailcrmReferences->payment_modules[0]);
|
||||
$this->assertArrayHasKey('code', $this->retailcrmReferences->payment_modules[0]);
|
||||
$this->assertArrayHasKey('id', $this->retailcrmReferences->payment_modules[0]);
|
||||
|
||||
if (version_compare(_PS_VERSION_, '1.7', '>')) {
|
||||
$this->assertNotEmpty($this->retailcrmReferences->payment_modules);
|
||||
$this->assertArrayHasKey('name', $this->retailcrmReferences->payment_modules[0]);
|
||||
$this->assertArrayHasKey('code', $this->retailcrmReferences->payment_modules[0]);
|
||||
$this->assertArrayHasKey('id', $this->retailcrmReferences->payment_modules[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetStatuses()
|
||||
|
|
Loading…
Add table
Reference in a new issue