Fix compatibility with new version of HWIOAuthBundle

Add missing facebook logo, rework some html stuff with new design
This commit is contained in:
Joseph Bielawski 2013-10-11 13:41:11 +02:00
parent 96996e9bfc
commit 545c17bdfc
15 changed files with 93 additions and 66 deletions

View file

@ -5,22 +5,18 @@ php:
- 5.4
- 5.5
env: MONGO_VERSION=1.3.4
services: mongodb
install:
- sudo rm -rf /dev/shm && sudo ln -s /run/shm /dev/shm
before_script:
- wget http://pecl.php.net/get/mongo-1.4.3.tgz
- tar -xzf mongo-1.4.3.tgz
- sh -c "cd mongo-1.4.3 && phpize && ./configure && sudo make install"
- echo "extension=mongo.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`
- echo '' > ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
- echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
- ulimit -n 10000
- sudo apt-get update
- sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-mysql php5-curl wkhtmltopdf
- sudo apt-get install -y --force-yes apache2 libapache2-mod-php5 php5-curl wkhtmltopdf
- sudo sed -i -e "s,/var/www,$(pwd)/web,g" /etc/apache2/sites-available/default
- export MINK_EXTENSION_PARAMS='base_url=http://localhost:8000/app_test.php'
- sudo /etc/init.d/apache2 restart
@ -37,40 +33,41 @@ before_script:
- sleep 5
script:
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@cart && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@taxation && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@shipping && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@addressing && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@promotions && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@inventory && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@taxonomies && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@settings && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@payments && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@currencies && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@account && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@addressing && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@cart && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@checkout && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@homepage && ~@javascript'
- php -d memory_limit=4096M bin/behat --no-snippets --no-paths --verbose --tags '@products && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@users && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@currencies && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@dashboard && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@homepage && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@inventory && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@orders && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@payments && ~@javascript'
- php -d memory_limit=4096M bin/behat --no-snippets --no-paths --verbose --tags '@products && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@promotions && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@settings && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@shipping && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@taxation && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@taxonomies && ~@javascript'
- php -d memory_limit=2048M bin/behat --no-snippets --no-paths --verbose --tags '@users && ~@javascript,@oauth'
- cd src/Sylius/Bundle/AddressingBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../CartBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../InventoryBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../OmnipayBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../CoreBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../OrderBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../ProductBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../VariableProductBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../TaxationBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../ShippingBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../TaxonomiesBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../ResourceBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../InventoryBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../InstallerBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../MoneyBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../SettingsBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../PromotionsBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../OmnipayBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../OrderBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../PaymentsBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../PayumBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../ProductBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../PromotionsBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../ResourceBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../SettingsBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../ShippingBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../TaxationBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../TaxonomiesBundle; ../../../../bin/phpspec run -fpretty --verbose
- cd ../VariableProductBundle; ../../../../bin/phpspec run -fpretty --verbose
notifications:
email: "travis-ci@sylius.org"

View file

@ -5,7 +5,6 @@
<h1>Registration <small>Create an account in store</small></h1>
</div>
<form action="{{ path('fos_user_registration_register') }}" method="post" novalidate class="form-horizontal">
<fieldset class="well">
{% for field in form %}

View file

@ -32,11 +32,13 @@
</div>
<div class="form-group">
<div class="controls">
Remember me? &nbsp; <input type="checkbox" id="remember_me" name="_remember_me" value="on" />
<label for="remember_me">
Remember me? &nbsp; <input type="checkbox" id="remember_me" name="_remember_me" value="on" />
</label>
</div>
</div>
</fieldset>
<div class="form-actions">
<div class="form-actions clearfix">
<div class="pull-right">
{{ render(url('hwi_oauth_connect')) }}
</div>

View file

@ -1,3 +1,5 @@
{% for owner in hwi_oauth_resource_owners() %}
<a class="oauth-login oauth-login-{{ owner | trans({}, 'HWIOAuthBundle') }}" href="{{ hwi_oauth_login_url(owner) }}" title="{{ owner | trans({}, 'HWIOAuthBundle') }}"><span></span></a>
<a class="oauth-login oauth-login-{{ owner|trans({}, 'HWIOAuthBundle') }}" href="{{ hwi_oauth_login_url(owner) }}" title="{{ owner|trans({}, 'HWIOAuthBundle') }}">
<img src="/assets/img/icon/64/{{ owner|trans({}, 'HWIOAuthBundle') }}.png" alt="{{ owner|trans({}, 'HWIOAuthBundle') }}">
</a>
{% endfor %}

View file

@ -26,7 +26,7 @@
"doctrine/orm": "~2.3",
"friendsofsymfony/rest-bundle": "~1.0",
"friendsofsymfony/user-bundle": "2.0.*@dev",
"hwi/oauth-bundle": "0.3.*@dev",
"hwi/oauth-bundle": "0.3.*",
"incenteev/composer-parameter-handler": "~2.0",
"jms/serializer-bundle": "0.12.*",
"jms/translation-bundle": "1.1.*",

View file

@ -1,4 +1,4 @@
@users
@users @oauth
Feature: Sign in to the store via OAuth
In order to view my orders list
As a visitor with an OAuth account
@ -17,6 +17,7 @@ Feature: Sign in to the store via OAuth
Examples:
| provider_name | provider_site |
| Amazon | amazon.com |
| Facebook | facebook.com |
| Google | google.com |
Scenario Outline: Log in with username and password

View file

@ -1,4 +1,4 @@
@users
@users @oauth
Feature: User registration via OAuth
In order to order products
As a visitor with an OAuth account
@ -17,6 +17,7 @@ Feature: User registration via OAuth
Examples:
| provider_name | provider_site |
| Amazon | amazon.com |
| Facebook | facebook.com |
| Google | google.com |
Scenario Outline: Successfully creating account in store

View file

@ -23,6 +23,7 @@ use Sylius\Bundle\AddressingBundle\Model\AddressInterface;
class User extends BaseUser implements UserInterface
{
protected $amazonId;
protected $facebookId;
protected $googleId;
protected $firstName;
protected $lastName;
@ -57,6 +58,7 @@ class User extends BaseUser implements UserInterface
* Set ID of Amazon account attached to the user
*
* @param string $amazonId
*
* @return User
*/
public function setAmazonId($amazonId)
@ -69,17 +71,42 @@ class User extends BaseUser implements UserInterface
/**
* Get ID of Amazon account attached to the user
*
* @return string $amazonId
* @return string|null
*/
public function getAmazonId()
{
return $this->amazonId;
}
/**
* Set ID of Facebook account attached to the user
*
* @param string $facebookId
*
* @return User
*/
public function setFacebookId($facebookId)
{
$this->facebookId = $facebookId;
return $this;
}
/**
* Get ID of Facebook account attached to the user
*
* @return string|null
*/
public function getFacebookId()
{
return $this->facebookId;
}
/**
* Set ID of Google account attached to the user
*
* @param string $googleId
*
* @return User
*/
public function setGoogleId($googleId)
@ -92,7 +119,7 @@ class User extends BaseUser implements UserInterface
/**
* Get ID of Google account attached to the user
*
* @return string $googleId
* @return string|null
*/
public function getGoogleId()
{

View file

@ -15,6 +15,7 @@ use HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface;
use HWI\Bundle\OAuthBundle\Security\Core\User\FOSUBUserProvider;
use Sylius\Bundle\CoreBundle\Model\User;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* Loading and ad-hoc creation of a user by an OAuth sign-in provider account.
@ -43,7 +44,7 @@ class UserProvider extends FOSUBUserProvider
/**
* {@inheritDoc}
*/
public function connect($user, UserResponseInterface $response)
public function connect(UserInterface $user, UserResponseInterface $response)
{
$providerName = $response->getResourceOwner()->getName();
$uniqueId = $response->getUsername();

View file

@ -27,6 +27,7 @@
<field name="lastName" column="last_name" type="string" nullable="true" />
<field name="amazonId" column="amazon_id" type="string" nullable="true" />
<field name="facebookId" column="facebook_id" type="string" nullable="true" />
<field name="googleId" column="google_id" type="string" nullable="true" />
<one-to-many field="orders" target-entity="Sylius\Bundle\OrderBundle\Model\OrderInterface" mapped-by="user">

View file

@ -269,6 +269,7 @@
<argument type="service" id="fos_user.user_manager" />
<argument type="collection">
<argument key="amazon">amazonId</argument>
<argument key="facebook">facebookId</argument>
<argument key="google">googleId</argument>
</argument>
</service>

View file

@ -1,5 +1,14 @@
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace spec\Sylius\Bundle\CoreBundle\OAuth;
use PhpSpec\ObjectBehavior;

View file

@ -35,10 +35,9 @@ class OAuthContext extends RawMinkContext
public function iAllowTheUseOfMyAccount($providerName, $domain)
{
if ($this->currentUrlContains($domain)) {
$submitButtons = $this->getSession('selenium2')->getPage()->findAll('xpath', '//form//button[@type="submit"]');
if (count($submitButtons) != 2) {
throw new ExpectationException('Page should contain a form with 2 buttons.', $this->getSession('selenium2'));
if (count($submitButtons) != 3) {
throw new ExpectationException('Page should contain a form with 3 buttons.', $this->getSession('selenium2'));
}
if ($providerName == 'Google') {
@ -46,7 +45,6 @@ class OAuthContext extends RawMinkContext
} else {
$submitButtons[1]->click();
}
}
}
@ -57,8 +55,7 @@ class OAuthContext extends RawMinkContext
public function iShouldBeOnTheWebsite($domain)
{
if (!$this->currentUrlContains($domain)) {
$message = sprintf('Current URL should contain "%s".', $domain);
throw new ExpectationException($message, $this->getSession('selenium2'));
throw new ExpectationException(sprintf('Current URL should contain "%s".', $domain), $this->getSession('selenium2'));
}
}
@ -68,8 +65,7 @@ class OAuthContext extends RawMinkContext
public function iShouldNotBeOnTheWebsiteAnymore($domain)
{
if ($this->currentUrlContains($domain)) {
$message = sprintf('Current URL should not contain "%s".', $domain);
throw new ExpectationException($message, $this->getSession('selenium2'));
throw new ExpectationException(sprintf('Current URL should not contain "%s".', $domain), $this->getSession('selenium2'));
}
// Re-set default session

View file

@ -8,7 +8,7 @@ h1.logo {
}
h1.logo a {
color: #333333;
color: #333;
}
h1.logo a img {
@ -25,7 +25,7 @@ h1.logo a:hover {
}
.jumbotron {
margin: 20px 0px 40px 0px;
margin: 20px 0 40px;
text-align: center;
}
@ -96,7 +96,7 @@ div.product-box a img {
div.product-box .btn {
float: right;
height: 25px;
padding: 1px 6px 7px 6px;
padding: 1px 6px 7px;
}
div.product-box span.label {
@ -105,7 +105,7 @@ div.product-box span.label {
}
div.product-box h3 {
color: #333333;
color: #333;
}
div.footer p {
@ -114,7 +114,7 @@ div.footer p {
}
div.footer ul li a {
color: #999999;
color: #999;
}
#sidebar ul li img.menu-thumbnail {
@ -157,16 +157,6 @@ a.oauth-login {
margin-right: 8px;
}
a.oauth-login span {
display: inline-block;
width: 64px;
height: 64px;
}
a.oauth-login-amazon span {
background: url('/assets/img/icon/64/amazon.png') no-repeat;
}
a.oauth-login-google span {
background: url('/assets/img/icon/64/google.png') no-repeat;
a.oauth-login:hover {
text-decoration: none;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB