Skip to content

Commit 9beb0ea

Browse files
committed
init sylius ht payway plugin
0 parents  commit 9beb0ea

Some content is hidden

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

43 files changed

+993
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/bin/*
2+
!/bin/.gitkeep
3+
4+
/vendor/
5+
/node_modules/
6+
/composer.lock
7+
8+
/etc/build/*
9+
!/etc/build/.gitkeep
10+
11+
/tests/Application/yarn.lock

.travis.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
language: php
2+
3+
dist: trusty
4+
5+
sudo: false
6+
7+
php:
8+
- 7.1
9+
- 7.2
10+
11+
cache:
12+
yarn: true
13+
directories:
14+
- ~/.composer/cache/files
15+
- $SYLIUS_CACHE_DIR
16+
17+
env:
18+
global:
19+
- SYLIUS_CACHE_DIR=$HOME/.sylius-cache
20+
- SYLIUS_BUILD_DIR=etc/build
21+
22+
before_install:
23+
- phpenv config-rm xdebug.ini
24+
- echo "memory_limit=4096M" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
25+
- mkdir -p "${SYLIUS_CACHE_DIR}"
26+
27+
install:
28+
- composer install --no-interaction --prefer-dist
29+
- (cd tests/Application && yarn install)
30+
31+
before_script:
32+
- (cd tests/Application && bin/console doctrine:database:create --env=test -vvv)
33+
- (cd tests/Application && bin/console doctrine:schema:create --env=test -vvv)
34+
- (cd tests/Application && bin/console assets:install web --env=test -vvv)
35+
- (cd tests/Application && yarn run gulp)
36+
37+
# Configure display
38+
- /sbin/start-stop-daemon --start --quiet --pidfile /tmp/xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1680x1050x16
39+
- export DISPLAY=:99
40+
41+
# Download and configure ChromeDriver
42+
- |
43+
if [ ! -f $SYLIUS_CACHE_DIR/chromedriver ] || [ "$($SYLIUS_CACHE_DIR/chromedriver --version | grep -c 2.34)" = "0" ]; then
44+
curl http://chromedriver.storage.googleapis.com/2.34/chromedriver_linux64.zip > chromedriver.zip
45+
unzip chromedriver.zip
46+
chmod +x chromedriver
47+
mv chromedriver $SYLIUS_CACHE_DIR
48+
fi
49+
50+
# Run ChromeDriver
51+
- $SYLIUS_CACHE_DIR/chromedriver > /dev/null 2>&1 &
52+
53+
# Download and configure Selenium
54+
- |
55+
if [ ! -f $SYLIUS_CACHE_DIR/selenium.jar ] || [ "$(java -jar $SYLIUS_CACHE_DIR/selenium.jar --version | grep -c 3.4.0)" = "0" ]; then
56+
curl http://selenium-release.storage.googleapis.com/3.4/selenium-server-standalone-3.4.0.jar > selenium.jar
57+
mv selenium.jar $SYLIUS_CACHE_DIR
58+
fi
59+
60+
# Run Selenium
61+
- java -Dwebdriver.chrome.driver=$SYLIUS_CACHE_DIR/chromedriver -jar $SYLIUS_CACHE_DIR/selenium.jar > /dev/null 2>&1 &
62+
63+
# Run webserver
64+
- (cd tests/Application && bin/console server:run 127.0.0.1:8080 -d web --env=test --quiet > /dev/null 2>&1 &)
65+
66+
script:
67+
- composer validate --strict
68+
- bin/phpstan.phar analyse -c phpstan.neon -l max src/
69+
70+
- bin/phpunit
71+
- bin/phpspec run
72+
- bin/behat --strict -vvv --no-interaction || bin/behat --strict -vvv --no-interaction --rerun
73+
74+
after_failure:
75+
- vendor/lakion/mink-debug-extension/travis/tools/upload-textfiles "${SYLIUS_BUILD_DIR}/*.log"

README.md

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<p align="center">
2+
<a href="http://sylius.org" target="_blank">
3+
<img src="http://demo.sylius.org/assets/shop/img/logo.png" />
4+
</a>
5+
</p>
6+
<h1 align="center">Plugin Skeleton</h1>
7+
<p align="center">
8+
<a href="https://packagist.org/packages/sylius/plugin-skeleton" title="License">
9+
<img src="https://img.shields.io/packagist/l/sylius/plugin-skeleton.svg" />
10+
</a>
11+
<a href="https://packagist.org/packages/sylius/plugin-skeleton" title="Version">
12+
<img src="https://img.shields.io/packagist/v/sylius/plugin-skeleton.svg" />
13+
</a>
14+
<a href="http://travis-ci.org/Sylius/PluginSkeleton" title="Build status">
15+
<img src="https://img.shields.io/travis/Sylius/PluginSkeleton/master.svg" />
16+
</a>
17+
<a href="https://scrutinizer-ci.com/g/Sylius/PluginSkeleton/" title="Scrutinizer">
18+
<img src="https://img.shields.io/scrutinizer/g/Sylius/PluginSkeleton.svg" />
19+
</a>
20+
</p>
21+
22+
## Installation
23+
24+
1. Run `composer create-project sylius/plugin-skeleton ProjectName`.
25+
26+
2. From the plugin skeleton root directory, run the following commands:
27+
28+
```bash
29+
$ (cd tests/Application && yarn install)
30+
$ (cd tests/Application && yarn run gulp)
31+
$ (cd tests/Application && bin/console assets:install web -e test)
32+
33+
$ (cd tests/Application && bin/console doctrine:database:create -e test)
34+
$ (cd tests/Application && bin/console doctrine:schema:create -e test)
35+
```
36+
37+
## Usage
38+
39+
### Running plugin tests
40+
41+
- PHPUnit
42+
43+
```bash
44+
$ bin/phpunit
45+
```
46+
47+
- PHPSpec
48+
49+
```bash
50+
$ bin/phpspec run
51+
```
52+
53+
- Behat (non-JS scenarios)
54+
55+
```bash
56+
$ bin/behat --tags="~@javascript"
57+
```
58+
59+
- Behat (JS scenarios)
60+
61+
1. Download [Chromedriver](https://sites.google.com/a/chromium.org/chromedriver/)
62+
63+
2. Run Selenium server with previously downloaded Chromedriver:
64+
65+
```bash
66+
$ bin/selenium-server-standalone -Dwebdriver.chrome.driver=chromedriver
67+
```
68+
3. Run test application's webserver on `localhost:8080`:
69+
70+
```bash
71+
$ (cd tests/Application && bin/console server:run 127.0.0.1:8080 -d web -e test)
72+
```
73+
74+
4. Run Behat:
75+
76+
```bash
77+
$ bin/behat --tags="@javascript"
78+
```
79+
80+
### Opening Sylius with your plugin
81+
82+
- Using `test` environment:
83+
84+
```bash
85+
$ (cd tests/Application && bin/console sylius:fixtures:load -e test)
86+
$ (cd tests/Application && bin/console server:run -d web -e test)
87+
```
88+
89+
- Using `dev` environment:
90+
91+
```bash
92+
$ (cd tests/Application && bin/console sylius:fixtures:load -e dev)
93+
$ (cd tests/Application && bin/console server:run -d web -e dev)
94+
```

behat.yml.dist

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
imports:
2+
- vendor/sylius/sylius/behat.yml.dist
3+
- tests/Behat/Resources/suites.yml
4+
5+
default:
6+
extensions:
7+
FriendsOfBehat\ContextServiceExtension:
8+
imports:
9+
- vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml
10+
- tests/Behat/Resources/services.xml
11+
12+
FriendsOfBehat\SymfonyExtension:
13+
kernel:
14+
class: AppKernel
15+
path: tests/Application/app/AppKernel.php
16+
bootstrap: vendor/autoload.php
17+
18+
Lakion\Behat\MinkDebugExtension:
19+
directory: etc/build
20+
clean_start: false
21+
screenshot: true

bin/.gitkeep

Whitespace-only changes.

composer.json

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "locastic/sylius-ht-payway-plugin",
3+
"type": "sylius-plugin",
4+
"description": "HT PayWay payment plugin for Sylius applications",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Locastic",
9+
"email": "info@locastic.com"
10+
},
11+
{
12+
"name": "Antonio Peric-Mazar",
13+
"email": "antonio@locastic.com"
14+
}
15+
],
16+
"require": {
17+
"php": "^7.1",
18+
19+
"sylius/sylius": "^1.1"
20+
},
21+
"require-dev": {
22+
"behat/behat": "^3.3",
23+
"behat/mink": "^1.7",
24+
"behat/mink-browserkit-driver": "^1.3",
25+
"behat/mink-extension": "^2.2",
26+
"behat/mink-selenium2-driver": "^1.3",
27+
"friends-of-behat/context-service-extension": "^1.0",
28+
"friends-of-behat/cross-container-extension": "^1.0",
29+
"friends-of-behat/service-container-extension": "^1.0",
30+
"friends-of-behat/symfony-extension": "^1.0",
31+
"friends-of-behat/variadic-extension": "^1.0",
32+
"lakion/mink-debug-extension": "^1.2.3",
33+
"phpspec/phpspec": "^3.2",
34+
"phpstan/phpstan-shim": "^0.9.2",
35+
"phpunit/phpunit": "^6.5",
36+
"se/selenium-server-standalone": "^2.52",
37+
"sylius-labs/coding-standard": "^1.0",
38+
"symplify/easy-coding-standard": "^2.4"
39+
},
40+
"prefer-stable": true,
41+
"autoload": {
42+
"psr-4": {
43+
"Locastic\\SyliusHTPayWayPlugin\\": "src/",
44+
"Tests\\Locastic\\SyliusHTPayWayPlugin\\": "tests/"
45+
}
46+
},
47+
"autoload-dev": {
48+
"classmap": ["tests/Application/app/AppKernel.php"]
49+
},
50+
"extra": {
51+
"branch-alias": {
52+
"dev-master": "1.1-dev"
53+
}
54+
},
55+
"config": {
56+
"bin-dir": "bin"
57+
}
58+
}

easy-coding-standard.neon

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
includes:
2+
- vendor/sylius-labs/coding-standard/easy-coding-standard.neon

etc/build/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@greeting_customer @javascript
2+
Feature: Dynamically greeting a customer
3+
In order to provide an ultimate customer experience
4+
As a Store Owner
5+
I want to welcome new customers dynamically
6+
7+
Scenario: Dynamically greeting a customer with an unknown name
8+
When a customer with an unknown name visits dynamic welcome page
9+
Then they should be dynamically greeted with "Hello!"
10+
11+
Scenario: Dynamically greeting a customer with a known name
12+
When a customer named "Krzysztof" visits dynamic welcome page
13+
Then they should be dynamically greeted with "Hello, Krzysztof!"
14+
15+
Scenario: Dynamically greeting Lionel Richie
16+
When a customer named "Lionel Richie" visits dynamic welcome page
17+
Then they should be dynamically greeted with "Hello, is it me you're looking for?"
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Sylius/Sylius:features/product/managing_products/adding_products_with_text_attribute.feature
2+
3+
@managing_products
4+
Feature: Adding a new product with text attribute
5+
In order to extend my merchandise with more complex products
6+
As an Administrator
7+
I want to add a new product with text attribute to the shop
8+
9+
Background:
10+
Given the store operates on a single channel in "United States"
11+
And the store has a text product attribute "Gun caliber"
12+
And the store has a text product attribute "Overall length"
13+
And I am logged in as an administrator
14+
15+
@ui @javascript
16+
Scenario: Adding a text attribute to product
17+
Given I want to create a new simple product
18+
When I specify its code as "44_MAGNUM"
19+
And I name it "44 Magnum" in "English (United States)"
20+
And I set its price to "$100.00" for "United States" channel
21+
And I set its "Gun caliber" attribute to "11 mm" in "English (United States)"
22+
And I add it
23+
Then I should be notified that it has been successfully created
24+
And the product "44 Magnum" should appear in the store
25+
And attribute "Gun caliber" of product "44 Magnum" should be "11 mm"
26+
27+
@ui @javascript
28+
Scenario: Adding multiple text attributes to product
29+
Given I want to create a new simple product
30+
When I specify its code as "44_MAGNUM"
31+
And I name it "44 Magnum" in "English (United States)"
32+
And I set its price to "$100.00" for "United States" channel
33+
And I set its "Gun caliber" attribute to "11 mm" in "English (United States)"
34+
And I set its "Overall length" attribute to "30.5 cm" in "English (United States)"
35+
And I add it
36+
Then I should be notified that it has been successfully created
37+
And the product "44 Magnum" should appear in the store
38+
And attribute "Gun caliber" of product "44 Magnum" should be "11 mm"
39+
And attribute "Overall length" of product "44 Magnum" should be "30.5 cm"
40+
41+
@ui @javascript
42+
Scenario: Adding and removing text attributes on product create page
43+
Given I want to create a new simple product
44+
When I specify its code as "44_MAGNUM"
45+
And I name it "44 Magnum" in "English (United States)"
46+
And I set its price to "$100.00" for "United States" channel
47+
And I set its "Gun caliber" attribute to "11 mm" in "English (United States)"
48+
And I set its "Overall length" attribute to "30.5 cm" in "English (United States)"
49+
And I remove its "Gun caliber" attribute
50+
And I add it
51+
Then I should be notified that it has been successfully created
52+
And the product "44 Magnum" should appear in the store
53+
And attribute "Overall length" of product "44 Magnum" should be "30.5 cm"
54+
And product "44 Magnum" should not have a "Gun caliber" attribute
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@greeting_customer
2+
Feature: Statically greeting a customer
3+
In order to provide an ultimate customer experience
4+
As a Store Owner
5+
I want to welcome new customers
6+
7+
Scenario: Statically greeting a customer with an unknown name
8+
When a customer with an unknown name visits static welcome page
9+
Then they should be statically greeted with "Hello!"
10+
11+
Scenario: Statically greeting a customer with a known name
12+
When a customer named "Krzysztof" visits static welcome page
13+
Then they should be statically greeted with "Hello, Krzysztof!"
14+
15+
Scenario: Statically greeting Lionel Richie
16+
When a customer named "Lionel Richie" visits static welcome page
17+
Then they should be statically greeted with "Hello, is it me you're looking for?"

node_modules

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tests/Application/node_modules

phpspec.yml.dist

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
suites:
2+
main:
3+
namespace: Acme\SyliusExamplePlugin
4+
psr4_prefix: Acme\SyliusExamplePlugin

phpstan.neon

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
parameters:
2+
excludes_analyse:
3+
# Makes PHPStan crash
4+
- 'src/DependencyInjection/Configuration.php'
5+
6+
# Test dependencies
7+
- 'tests/Application/app/**.php'
8+
- 'tests/Application/src/**.php'
9+
10+
ignoreErrors:
11+
- '/Parameter #1 $configuration of method Symfony\Component\DependencyInjection\Extension\Extension::processConfiguration() expects Symfony\Component\Config\Definition\ConfigurationInterface, Symfony\Component\Config\Definition\ConfigurationInterface|null given./'

phpunit.xml.dist

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/5.6/phpunit.xsd"
5+
backupGlobals="false"
6+
colors="true"
7+
bootstrap="vendor/autoload.php">
8+
<testsuites>
9+
<testsuite name="AcmeSyliusExamplePlugin Test Suite">
10+
<directory>tests</directory>
11+
</testsuite>
12+
</testsuites>
13+
14+
<php>
15+
<server name="KERNEL_CLASS_PATH" value="/tests/Application/AppKernel.php" />
16+
<server name="IS_DOCTRINE_ORM_SUPPORTED" value="true" />
17+
</php>
18+
</phpunit>

0 commit comments

Comments
 (0)