Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit 2d0c9cd

Browse files
author
Jens Schulze
committed
Merge branch 'release/v1.0.0-RC10'
2 parents 18829ef + ae4a2a8 commit 2d0c9cd

File tree

701 files changed

+13057
-1135
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

701 files changed

+13057
-1135
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ cache.properties
88
apigen.phar
99
composer.phar
1010
composer.lock
11+
myapp.yml
1112
myapp.ini
1213
/local/
1314
/tools/node_modules
1415
requests.log
16+
env.list

.scrutinizer.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ tools:
99
php_cs_fixer:
1010
config: { level: psr2 }
1111
before_commands:
12-
- composer install --prefer-source -o
12+
- composer config -g github-oauth.github.com $GITHUB_OAUTH_TOKEN
13+
- composer global require hirak/prestissimo
14+
- composer install --prefer-dist -o
1315
build:
1416
environment:
15-
php: '5.5.25'
17+
php: '7.0'
1618
dependencies:
1719
before:
1820
#Only 5.4 uses APC
@@ -24,7 +26,7 @@ build:
2426
-
2527
command: vendor/bin/behat -f progress
2628
-
27-
command: vendor/bin/phpunit --testsuite=unit --coverage-clover=coverage0
29+
command: vendor/bin/phpunit -d zend.enable_gc=0 --coverage-clover=coverage0
2830
coverage:
2931
file: 'coverage0'
3032
format: 'php-clover'

.travis.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ before_script:
2222
- composer config -g github-oauth.github.com $GITHUB_OAUTH_TOKEN
2323
- sh -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ `php-config --vernum` -lt 70000 ] ; then echo 'extension = redis.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini ; fi"
2424
- sh -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ `php-config --vernum` -ge 50400 ] && [ `php-config --vernum` -lt 70000 ]; then printf "yes\n" | pecl install -f apcu-4.0.10 ; fi"
25-
- sh -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ `php-config --vernum` -ge 70000 ] ; then printf "yes\n" | pecl install -f apcu ; echo 'extension="apcu.so"' >> ./tests/apc.ini ; fi"
25+
- sh -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ] && [ `php-config --vernum` -ge 70000 ] ; then printf "yes\n" | pecl install -f apcu ; fi"
2626
- sh -c "if [ $TRAVIS_PHP_VERSION != 'hhvm' ] ; then phpenv config-add ./tests/apc.ini; fi"
2727
- if [ $TRAVIS_PHP_VERSION == '5.4' ] ; then ./set_guzzle5.sh; fi
28-
- composer install -o
28+
- composer global require hirak/prestissimo
29+
- composer self-update
30+
- composer install -o --prefer-dist
2931

3032
script:
3133
- ant phpcs-ci
@@ -36,16 +38,6 @@ script:
3638
after_success:
3739
- ./push-docs-to-gh-pages.sh
3840

39-
env:
40-
global:
41-
# GH_TOKEN environment variable for pushing documentation:
42-
- secure: "i0TL7GsZ8TIZgr7WB5qXEs8fF5sSJHGagLXEsn4DSgxI52GatfjeEaSJuAbbWV/Tg0jYidNevdhCpe7LT3IWwa2cLVRpaV1TDoQ6K4wo8zzMzAw4AMB8DO2dBY3Mz+puRN55YAV3OpEF/RiiIc7zXLW/+5H9UCOXrcnnpg6PpxE="
43-
# SPHERE_CLIENT_ID
44-
- secure: MEht7kleJ/K9/daNOjEpPNJnXxKyQZ36oEM8fImi612BoJmZp/uwjuKpqKscIyyLwXSpsr7c9w+V2CfSk3QI+NGLnhSNgjJWE2QXxzxD6OgM0gKFTDtBq//+k77Sx4UnQDi0pQPRZ1BrfBUqrxw4H07i53hXd/kmjZnknRcbODc=
45-
# SPHERE_CLIENT_SECRET
46-
- secure: Q4zRyFxLw/7YlHG/iWzyR7V7Srm8LsQ3UgMshckUyqefhzhF19GefoPJdPdALyLVEYQMG3O/U1aebbyt8Puy5jWWKKiwFaQA+mMXzpBFcvhutgxByqBXdIysIhGU65No+WbiCKlpL2WPNtYvE1cMSjFfn7IX8ThGkBxhJQcha38=
47-
# SPHERE_PROJECT
48-
- secure: CPj46vCtmLaxGKXycJW+PmNXloXu5ruOV/Qg1mA6tU83oPjlxHVrqMOlb87ykf6U8X6XXAjMrgR0q3gBepPJg3HZmJyeOsVhwSU/jhfN7L1lR7BrQrPdLutvhuC6Fgj+b2Ubzh7PIt7pR6AYZyMCv5ofajW9aBcC5D556WJsSjE=
4941
notifications:
5042
hipchat:
5143
rooms:

CHANGELOG.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,73 @@
1+
<a name="1.0.0-RC10"></a>
2+
# [1.0.0-RC10](https://github.com/sphereio/commercetools-php-sdk/compare/v1.0.0-RC9...v1.0.0-RC10) (2016-03-22)
3+
4+
5+
### Bug Fixes
6+
7+
* **CartDiscount:** fix cart discount target with correct type ([220c1da](https://github.com/sphereio/commercetools-php-sdk/commit/220c1da))
8+
* **Client:** fix guzzle5 adapter to send user agent ([3ae8748](https://github.com/sphereio/commercetools-php-sdk/commit/3ae8748))
9+
* **Collection:** fix add function for collection ([993cddd](https://github.com/sphereio/commercetools-php-sdk/commit/993cddd))
10+
* **Collection:** fix collection iterator for associative collections ([2442677](https://github.com/sphereio/commercetools-php-sdk/commit/2442677))
11+
* **Customer:** fix exception on getDefaultAddresses for empty customer address ([7bd63a4](https://github.com/sphereio/commercetools-php-sdk/commit/7bd63a4))
12+
* **DateDecorator:** fix date overflow for date decorator on serialization ([9009b8f](https://github.com/sphereio/commercetools-php-sdk/commit/9009b8f))
13+
* **Inventory:** fix setSupplyChannel action for inventory update ([f356179](https://github.com/sphereio/commercetools-php-sdk/commit/f356179))
14+
* **LocalizedString:** use graceful flag for language property getter ([621195d](https://github.com/sphereio/commercetools-php-sdk/commit/621195d))
15+
* **Payment:** correct type mapping for transaction state ([0c6f36d](https://github.com/sphereio/commercetools-php-sdk/commit/0c6f36d))
16+
* **Reference:** remove obj from serialized result if resource is embedded ([79f8cba](https://github.com/sphereio/commercetools-php-sdk/commit/79f8cba))
17+
* **Review:** fix locale serialization for review models ([973129d](https://github.com/sphereio/commercetools-php-sdk/commit/973129d))
18+
19+
### Features
20+
21+
* **Category:** add metaDescription, metaKeywords, metaTitle to Category and CategoryDraft model ([5468676](https://github.com/sphereio/commercetools-php-sdk/commit/5468676))
22+
* **Customer:** add update actions to set customer's firstName, middleName, lastName and title ([b122225](https://github.com/sphereio/commercetools-php-sdk/commit/b122225))
23+
* **GraphQL:** add request to query GraphQL endpoint ([182641a](https://github.com/sphereio/commercetools-php-sdk/commit/182641a))
24+
* **LineItem:** add helper function to calculate discounted price ([961a493](https://github.com/sphereio/commercetools-php-sdk/commit/961a493))
25+
* **Payment:** add change amount planned update action ([2815f98](https://github.com/sphereio/commercetools-php-sdk/commit/2815f98))
26+
* **Product:** add product setCategoryOrderHint action ([9f8de04](https://github.com/sphereio/commercetools-php-sdk/commit/9f8de04))
27+
* **Product:** add set prices update action ([a8c4206](https://github.com/sphereio/commercetools-php-sdk/commit/a8c4206))
28+
* **ProductSearch:** support POST for filters and facets ([caeb0a5](https://github.com/sphereio/commercetools-php-sdk/commit/caeb0a5))
29+
* **ProductType:** add change isSearchable update action ([95395f9](https://github.com/sphereio/commercetools-php-sdk/commit/95395f9))
30+
* **ProductType:** add inputTip to attribute definition ([09288a4](https://github.com/sphereio/commercetools-php-sdk/commit/09288a4))
31+
* **ProductType:** add key to product type ([4e1d393](https://github.com/sphereio/commercetools-php-sdk/commit/4e1d393))
32+
* **Review:** add by key requests ([ebc4ece](https://github.com/sphereio/commercetools-php-sdk/commit/ebc4ece))
33+
* **Review:** add update by key request ([710c89e](https://github.com/sphereio/commercetools-php-sdk/commit/710c89e))
34+
* **Review:** update Review requests and models to API changes ([6634658](https://github.com/sphereio/commercetools-php-sdk/commit/6634658))
35+
* **ShippingMethod:** add delete request for shipping methods ([e5510f6](https://github.com/sphereio/commercetools-php-sdk/commit/e5510f6))
36+
* **State:** add set, add and remove roles update action ([7c9a28d](https://github.com/sphereio/commercetools-php-sdk/commit/7c9a28d))
37+
* **Type:** add by key delete requests ([509616f](https://github.com/sphereio/commercetools-php-sdk/commit/509616f))
38+
* **Type:** add type change key action ([1c2ebf4](https://github.com/sphereio/commercetools-php-sdk/commit/1c2ebf4))
39+
* **Type:** add type update by key request ([72e4bd2](https://github.com/sphereio/commercetools-php-sdk/commit/72e4bd2))
40+
* **Types:** add delete type by key request ([2450b7a](https://github.com/sphereio/commercetools-php-sdk/commit/2450b7a))
41+
* **Types:** add request to get type by key ([2b34ae9](https://github.com/sphereio/commercetools-php-sdk/commit/2b34ae9)), closes [#169](https://github.com/sphereio/commercetools-php-sdk/issues/169)
42+
43+
### DEPRECATION NOTE
44+
Facet, Filter, FilterRange and FilterRangeCollection in namespace Commercetools\Core\Model\Product have been marked as deprecated and will be removed in v1.0.0. Please use the classes found in namespace Commercetools\Core\Model\Product\Search instead.
45+
46+
### BREAKING CHANGES
47+
* Changed named constructors for type update actions
48+
49+
Before:
50+
51+
```
52+
TypeAddLocalizedEnumValueAction::ofEnum(...)
53+
TypeAddEnumValueAction::ofEnum(...)
54+
TypeChangeEnumValueOrderAction::ofEnums(...)
55+
TypeChangeLocalizedEnumValueOrderAction::ofEnums(...)
56+
TypeChangeLabelAction::ofLabel(...)
57+
```
58+
59+
After:
60+
61+
```
62+
TypeAddLocalizedEnumValueAction::ofNameAndEnum(...)
63+
TypeAddEnumValueAction::ofNameAndEnum(...)
64+
TypeChangeEnumValueOrderAction::ofNameAndEnums(...)
65+
TypeChangeLocalizedEnumValueOrderAction::ofNameAndEnums(...)
66+
TypeChangeLabelAction::ofNameAndLabel(...)
67+
```
68+
69+
70+
171
<a name="1.0.0-RC9"></a>
272
# [1.0.0-RC9](https://github.com/sphereio/commercetools-php-sdk/compare/v1.0.0-RC8...v1.0.0-RC9) (2016-01-11)
373

README.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# <img src="build/theme/resources/CT_cube_200px.png" width="40" align="center"></img> commercetools PHP SDK
22

3-
> STATUS: Release Candidate 9. We ask you to really use this API thoroughly now, especially the API design and object structure. Thank you very much!
3+
> STATUS: Release Candidate 10. We ask you to really use this API thoroughly now, especially the API design and object structure. Thank you very much!
44
>
55
> See the [Milestone Plan](https://github.com/sphereio/commercetools-php-sdk/milestones?direction=desc&sort=completeness&state=open) for details of what's planned in detail. We love feedback and [Issue reports](https://github.com/sphereio/commercetools-php-sdk/issues?q=is%3Aopen+is%3Aissue+sort%3Acreated-asc)!
66
> Up-to-Date planning status can be found on this [Waffle Board](https://waffle.io/sphereio/commercetools-php-sdk)
@@ -75,12 +75,16 @@ require '../vendor/autoload.php';
7575

7676
use Commercetools\Core\Request\Products\ProductProjectionSearchRequest;
7777
use Commercetools\Core\Client;
78+
use Commercetools\Core\Config;
79+
use Commercetools\Core\Model\Common\Context;
7880

7981
$config = [
8082
'client_id' => 'my client id',
8183
'client_secret' => 'my client secret',
8284
'project' => 'my project id'
8385
];
86+
$context = Context::of()->setLanguages(['en'])->setLocale('en_US')->setGraceful(true);
87+
$config = Config::fromArray($config)->setContext($context);
8488

8589
/**
8690
* create a search request and a client,
@@ -89,7 +93,7 @@ $config = [
8993
*/
9094
$search = ProductProjectionSearchRequest::of()->addParam('text.en', 'red');
9195

92-
$client = new Client($config);
96+
$client = Client::ofConfig($config);
9397
$products = $client->execute($search)->toObject();
9498

9599
/**
@@ -156,13 +160,13 @@ ant
156160

157161
### Built In Test Server
158162

159-
You can use the `docroot` directory with the built-in PHP web server. Add to the docroot directory a file called "myapp.ini". Add following content and setup with your API credentials:
163+
You can use the `docroot` directory with the built-in PHP web server. Add to the docroot directory a file called "myapp.yml". Add following content and setup with your API credentials:
160164

161-
```ini
162-
[commercetools]
163-
client_id = 'my client id'
164-
client_secret = 'my client secret'
165-
project = 'my project id'
165+
```yaml
166+
parameters:
167+
client_id: my client id
168+
client_secret: my client secret
169+
project: my project id
166170
```
167171

168172
Then activate the php builtin web server
@@ -180,6 +184,20 @@ To enable code style checks directly in phpStorm you have to configure the path
180184
Now you can enable at Preferences > Editor > Inspections > PHP the "PHP code sniffer validation" with PSR-2 standard. Change the severity if needed.
181185

182186

187+
### Running tests using docker
188+
189+
Running the test image:
190+
191+
```sh
192+
echo "COMMERCETOOLS_CLIENT_ID=YourClientID" > env.list
193+
echo "COMMERCETOOLS_CLIENT_SECRET=YourClientSecret" >> env.list
194+
echo "COMMERCETOOLS_PROJECT=YourProjectKey" >> env.list
195+
echo "COMMERCETOOLS_OAUTH_URL=https://auth.sphere.io/oauth/token" >> env.list
196+
echo "COMMERCETOOLS_API_URL=https://api.sphere.io" >> env.list
197+
198+
docker run --env-file env.list -v $PWD:/opt/app -w /opt/app --rm=true jaysde/php-test-base tools/docker-phpunit.sh
199+
```
200+
183201
### <a name="contribute"></a>Contribute
184202

185203
On bigger effort changes, please open a GitHub [issue](issues) and ask if you can help or get help with your idea. For typos and documentation improvements just make a pull request.

build/theme/@layout.latte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<meta charset="utf-8">
77
<meta name="robots" content="noindex" n:if="!$robots">
88

9-
<title>ct SDK: {include title}{if 'overview' !== $active && $config->title}{/if}</title>
9+
<title>CTP SDK {getenv('SDK_VERSION')}: {include title}{if 'overview' !== $active && $config->title}{/if}</title>
1010

1111
<link rel="stylesheet" href="{='resources/bootstrap.min.css'|staticFile}">
1212
<link rel="stylesheet" href="{='resources/style.css'|staticFile}">
1313
<link n:if="$config->googleCseId" rel="search" type="application/opensearchdescription+xml" title="{$config->title}" href="{$config->baseUrl}/opensearch.xml">
14-
14+
<link rel="shortcut icon" type="image/png" href="{='resources/favicon.png'|staticFile}">
1515
<script n:if="$config->googleAnalytics">
1616
var _gaq = _gaq || [];
1717
_gaq.push(['_setAccount', {$config->googleAnalytics}]);
@@ -29,7 +29,7 @@
2929
<nav id="navigation" class="navbar navbar-default navbar-fixed-top">
3030
<div class="container-fluid">
3131
<div class="navbar-header">
32-
<a href="index.html" class="navbar-brand"><img src="{='resources/ct-logo.svg'|staticFile}" id="navbar-logo" alt="commercetools platform PHP SDK">{if $config->title}{$config->title}{else}Overview{/if}</a>
32+
<a href="index.html" class="navbar-brand"><img src="{='resources/ct-logo.svg'|staticFile}" id="navbar-logo" alt="commercetools platform PHP SDK">{if $config->title}{$config->title} {getenv('SDK_VERSION')}{else}Overview{/if}</a>
3333
</div>
3434
<div class="collapse navbar-collapse">
3535

build/theme/class.latte

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,18 @@
8686
<tr><th>Located at</td><td><a n:tag-if="$config->sourceCode" href="{$class|sourceUrl}" title="Go to source code">{$class->fileName|relativePath}</a></td></tr>
8787
{/if}
8888

89+
{var $sphereDoc = '//dev.commercetools.com/'}
8990
{foreach $template->annotationSort($template->annotationFilter($class->annotations)) as $annotation => $values}
9091
{foreach $values as $value}
91-
{if $annotation == "apidoc"}
92-
<tr><th>API documentation</th><td><b><a href="{$value|noescape}" target="api-doc">{$value|noescape}</a></b></span></td></tr>
93-
{elseif $annotation == "description"}
92+
{if $annotation == "link"}
93+
{php if (strpos($value, $sphereDoc) === false) continue; }
94+
<tr><th>API documentation</th><td>
95+
<b><a href="{$value|noescape}" target="api-doc">{$value|noescape}</a></b></span></td></tr>
96+
{/if}
97+
{/foreach}
98+
{foreach $values as $value}
99+
{php if (strpos($value, $sphereDoc) !== false) continue; }
100+
{if $annotation == "description"}
94101
<tr><td colspan="2">{$value|annotation:$annotation:$class|noescape}</td></tr>
95102
{else}
96103
<tr><th>{$annotation|annotationBeautify}</th><td>{$value|annotation:$annotation:$class|noescape}</td></tr>

build/theme/resources/favicon.png

672 Bytes
Loading

composer.json

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,31 @@
4545
"monolog/monolog": "^1.12",
4646
"behat/behat": "^3.0",
4747
"phpunit/phpcov": "*",
48-
"fabpot/php-cs-fixer": "@stable"
48+
"fabpot/php-cs-fixer": "@stable",
49+
"symfony/yaml": "*",
50+
"incenteev/composer-parameter-handler": "^2.0",
51+
"munkie/phpunit-teamcity-testlistener": "^1.2",
52+
"micheh/teamcity-clover": "^0.6.0"
53+
},
54+
"scripts": {
55+
"updateConfig": [
56+
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
57+
],
58+
"post-update-cmd": "@updateConfig",
59+
"post-install-cmd": "@updateConfig"
60+
},
61+
"extra": {
62+
"incenteev-parameters": [
63+
{
64+
"file": "docroot/myapp.yml",
65+
"env-map": {
66+
"client_id": "COMMERCETOOLS_CLIENT_ID",
67+
"client_secret": "COMMERCETOOLS_CLIENT_SECRET",
68+
"project": "COMMERCETOOLS_PROJECT",
69+
"oauth_url": "COMMERCETOOLS_OAUTH_URL",
70+
"api_url": "COMMERCETOOLS_API_URL"
71+
}
72+
}
73+
]
4974
}
5075
}

docroot/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
use Commercetools\Core\Model\Product\ProductProjection;
1212
use Commercetools\Core\Model\Product\ProductProjectionCollection;
1313
use Commercetools\Core\Request\Products\ProductProjectionSearchRequest;
14+
use Symfony\Component\Yaml\Yaml;
1415

1516
require '../vendor/autoload.php';
1617

17-
$appConfig = parse_ini_file('myapp.ini', true);
18-
18+
$appConfig = Yaml::parse(file_get_contents('myapp.yml'));
1919
$context = Context::of()->setLanguages(['en'])->setGraceful(true);
2020

2121
// create the api client config object
22-
$config = Config::fromArray($appConfig['commercetools'])->setContext($context);
22+
$config = Config::fromArray($appConfig['parameters'])->setContext($context);
2323

2424
/**
2525
* create search request

0 commit comments

Comments
 (0)