Skip to content

Commit

Permalink
Merge pull request #122 from juvenn/master
Browse files Browse the repository at this point in the history
修复 PHP 5.6 以下不能定义 array 常量的问题
  • Loading branch information
juvenn authored Nov 25, 2016
2 parents e8c7406 + ad99bd9 commit d45c434
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 14 deletions.
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 7.0

env:
- LC_API_REGION=US
- LC_API_REGION=US LC_APP_ID=wnDg0lPt0wcYGJSiHRwHBhD4 LC_APP_KEY=u9ekx9HFSFFBErWwyWHFmPDy LC_APP_HOST=127.0.0.1 LC_APP_PORT=8081

script:
- phpunit --coverage-clover=coverage.xml
- "make test_engine &"
- phpunit --coverage-clover=coverage.xml test

after_success:
- bash <(curl -s https://codecov.io/bash)

notifications:
webhooks: https://hook.bearychat.com/=bw52Y/travis/6e26f4422b2871c20a5b2d40e1d49f73

5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

0.5.1 发布日期:2016-11-25
----

* 修复 PHP 5.6 一下版本不能定义 array 常量的 bug

0.5.0 发布日期:2016-11-18
----

Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
forceCoversAnnotation="false">
<testsuites>
<testsuite name="unit">
<directory suffix="Test.php">tests</directory>
<directory suffix="Test.php">test</directory>
<exclude>tests/engine</exclude>
</testsuite>
</testsuites>
Expand Down
2 changes: 1 addition & 1 deletion src/LeanCloud/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Client {
/**
* Client version
*/
const VERSION = '0.5.0';
const VERSION = '0.5.1';

/**
* API Endpoints for Regions
Expand Down
10 changes: 8 additions & 2 deletions src/LeanCloud/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
*/
class Object {

const PRESERVED_KEYS = array("objectId", "updatedAt", "createdAt");
/**
* Preserved keys
*
* @var array
*/
public static $PRESERVED_KEYS = array("objectId", "updatedAt", "createdAt");

/**
* Map of registered className to class.
*
Expand Down Expand Up @@ -253,7 +259,7 @@ private function _set($key, $val) {
* @throws RuntimeException
*/
public function set($key, $val) {
if (in_array($key, self::PRESERVED_KEYS)) {
if (in_array($key, self::$PRESERVED_KEYS)) {
throw new \RuntimeException("Preserved field could not be set.");
}
return $this->_set($key, $val);
Expand Down
14 changes: 7 additions & 7 deletions test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public function testVerifyKey() {
$this->assertTrue($result);
}

public function testVerifyKeyMaster() {
$result = Client::verifyKey(
getenv("LC_APP_ID"),
getenv("LC_APP_MASTER_KEY") . ",master"
);
$this->assertTrue($result);
}
# public function testVerifyKeyMaster() {
# $result = Client::verifyKey(
# getenv("LC_APP_ID"),
# getenv("LC_APP_MASTER_KEY") . ",master"
# );
# $this->assertTrue($result);
# }

public function testVerifySign() {
$time = time();
Expand Down

0 comments on commit d45c434

Please sign in to comment.