Skip to content

Commit 2fcf2c9

Browse files
authored
Merge pull request #165 from conekta/upgrate/php_7.4
Upgrade/php 7.4
2 parents cdbc6b1 + cb36f6d commit 2fcf2c9

File tree

8 files changed

+25
-17
lines changed

8 files changed

+25
-17
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ composer.lock
88
INSTALL.txt
99
LICENSE.txt
1010
README.txt
11+
.phpunit.result.cache
1112
demos/
1213
extras/documentation

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [4.2.0](https://github.com/conekta/conekta-php/releases/tag/v4.2.0) - 2020-01-15
2+
### Feature
3+
- Fixing specs for PHP 7.4
4+
### Deprecating end(ConektaList)
5+
- Certain array functions (such as end) are no longer working as expected for ConektaList in PHP 7.4, though count, [] and each continue to be supported
6+
17
## [4.1.0](https://github.com/conekta/conekta-php/releases/tag/v4.1.0) - 2019-12-31
28
### Feature
39
- Correcting subscriptions errors in PHP 7.1+

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![banner](readme_files/banner.png)
44

5-
# Conekta PHP v.4.1.0
5+
# Conekta PHP
66

77
![php badge](readme_files/php-badge.png)
88
![conekta badge](readme_files/conekta-badge.png)
@@ -13,7 +13,7 @@ This is a PHP library that allows interaction with [Conekta's API](https://api.c
1313

1414
## Requeriments
1515

16-
PHPUnit 6.1 requires PHP 7; using the latest version of PHP is highly recommended.
16+
PHPUnit ~8 requires PHP 7.2+; using the latest version of PHP is highly recommended.
1717

1818
## Installation
1919

@@ -27,7 +27,7 @@ To get started, add the following to your PHP script:
2727

2828
You can also install this library with [Composer](https://github.com/composer/composer):
2929

30-
require: "conekta/conekta-php": "4.1.0"
30+
require: "conekta/conekta-php": "4.2.0"
3131

3232
## Usage
3333

@@ -89,23 +89,23 @@ Unit test based on PHP library [PHPUnit](https://github.com/sebastianbergmann/ph
8989
For better usage install PHPUnit globally:
9090

9191
```bash
92-
$ wget https://phar.phpunit.de/phpunit-6.1.phar
92+
$ wget https://phar.phpunit.de/phpunit-8.5.2.phar
9393

94-
$ chmod +x phpunit-6.1.phar
94+
$ chmod +x phpunit-8.5.2.phar
9595

96-
$ sudo mv phpunit-6.1.phar /usr/local/bin/phpunit
96+
$ sudo mv phpunit-8.5.2.phar /usr/local/bin/phpunit
9797

9898
$ phpunit --version
9999

100100
ej. output
101-
PHPUnit 6.1.1 by Sebastian Bergmann and contributors.
101+
PHPUnit 8.5.2 by Sebastian Bergmann and contributors.
102102

103103
```
104104

105105
PHP version used
106106

107107
```
108-
PHP 7.0.17 (cli)
108+
PHP 7.4.24 (cli)
109109
```
110110

111111
Run test suite:
@@ -114,9 +114,9 @@ Run test suite:
114114
phpunit test/Conekta-x.0
115115
```
116116

117-
_note:_ for this PHPUnit version (6.1.x) only PHP 7 is supported for older PHP versions see PHPunit <a href="https://phpunit.de/"> documentation</a>
117+
_note:_ for this PHPUnit version (8.x) only PHP 7.2+ is supported for older PHP versions see PHPunit <a href="https://phpunit.de/"> documentation</a>
118118

119-
## Changelong
119+
## Changelog
120120

121121
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
122122

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
}
1616
],
1717
"require": {
18-
"php": ">=7.1",
18+
"php": ">=7.2",
1919
"ext-curl": "*",
2020
"ext-json": "*",
2121
"ext-mbstring": "*"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "~7"
24+
"phpunit/phpunit": "~8"
2525
},
2626
"autoload": {
2727
"classmap": ["lib/Conekta/"]

lib/Conekta/Conekta.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ abstract class Conekta
1010
public static $locale = 'es';
1111
public static $plugin = '';
1212
public static $pluginVersion = '';
13-
const VERSION = '4.1.0';
13+
const VERSION = '4.2.0';
1414

1515

1616
public static function setApiKey($apiKey)

lib/Conekta/ConektaList.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ public function __construct($elements_type, $params = array())
2424
public function addElement($element)
2525
{
2626
$element = Util::convertToConektaObject($element);
27-
$this[$this->total] = $element;
28-
$this->_values[$this->total] = $element;
27+
$array_length = count($this->_values);
28+
$this[$array_length] = $element;
29+
$this->_values[$array_length] = $element;
2930
$this->total = $this->total + 1;
3031

3132
return $this;

lib/Conekta/ConektaResource.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ protected function _createMember($member, $params)
180180
$this->loadFromArray();
181181
}
182182
$instances = $this->$member;
183-
$instance = end($instances);
183+
$instance = $instances[count($instances) - 1];
184184
} else {
185185
$class = '\\Conekta\\' . ucfirst($member);
186186

test/Conekta-1.0/CustomerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testAddCardToCustomer()
4848
$this->setApiVersion('1.0.0');
4949
$customer = Customer::create(self::$validCustomer);
5050
$customer->createCard(array('token' => 'tok_test_visa_1881'));
51-
$this->assertTrue(strpos(end($customer->cards)->last4, '1881') !== false);
51+
$this->assertTrue(strpos($customer->cards[0]->last4, '1881') !== false);
5252
}
5353

5454
public function testDeleteCard()

0 commit comments

Comments
 (0)