Fix CS & behat feature

This commit is contained in:
Joseph Bielawski 2013-10-29 13:33:06 +01:00
parent 5711690252
commit 6cb8c8a1cc
4 changed files with 235 additions and 200 deletions

375
composer.lock generated
View file

@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
"hash": "8ea89411f78adc4740a2963a86c16442",
"hash": "77c1394ee09d51ad18089cca99191b25",
"packages": [
{
"name": "athari/yalinqo",
@ -53,12 +53,12 @@
"source": {
"type": "git",
"url": "https://github.com/doctrine/annotations.git",
"reference": "v1.1.2"
"reference": "40db0c96985aab2822edbc4848b3bd2429e02670"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/v1.1.2",
"reference": "v1.1.2",
"url": "https://api.github.com/repos/doctrine/annotations/zipball/40db0c96985aab2822edbc4848b3bd2429e02670",
"reference": "40db0c96985aab2822edbc4848b3bd2429e02670",
"shasum": ""
},
"require": {
@ -120,16 +120,16 @@
},
{
"name": "doctrine/cache",
"version": "v1.2.0",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "d0e4447707a064a5814b18cb0dcc2f24185f6179"
"reference": "e16d7adf45664a50fa86f515b6d5e7f670130449"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/d0e4447707a064a5814b18cb0dcc2f24185f6179",
"reference": "d0e4447707a064a5814b18cb0dcc2f24185f6179",
"url": "https://api.github.com/repos/doctrine/cache/zipball/e16d7adf45664a50fa86f515b6d5e7f670130449",
"reference": "e16d7adf45664a50fa86f515b6d5e7f670130449",
"shasum": ""
},
"require": {
@ -138,6 +138,10 @@
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
"phpunit/phpunit": ">=3.7",
"satooshi/php-coveralls": "~0.6"
},
"type": "library",
"extra": {
"branch-alias": {
@ -185,7 +189,7 @@
"cache",
"caching"
],
"time": "2013-09-26 19:23:25"
"time": "2013-10-25 19:04:14"
},
{
"name": "doctrine/collections",
@ -400,12 +404,12 @@
"source": {
"type": "git",
"url": "https://github.com/doctrine/DoctrineBundle.git",
"reference": "ef6c4381a1d182f78b83bc3890cfab0fa08a89f9"
"reference": "2ed46398aae1b7699f6fe7467faf54493b4f2a24"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/ef6c4381a1d182f78b83bc3890cfab0fa08a89f9",
"reference": "ef6c4381a1d182f78b83bc3890cfab0fa08a89f9",
"url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/2ed46398aae1b7699f6fe7467faf54493b4f2a24",
"reference": "2ed46398aae1b7699f6fe7467faf54493b4f2a24",
"shasum": ""
},
"require": {
@ -461,7 +465,7 @@
"orm",
"persistence"
],
"time": "2013-10-12 16:02:36"
"time": "2013-10-20 15:21:43"
},
{
"name": "doctrine/inflector",
@ -736,12 +740,12 @@
"source": {
"type": "git",
"url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git",
"reference": "f9ea1de0698e3055c9916e88c19f42e28844ef61"
"reference": "0cb03029c7c1c833a11c7bebf30125276f0aa5b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/f9ea1de0698e3055c9916e88c19f42e28844ef61",
"reference": "f9ea1de0698e3055c9916e88c19f42e28844ef61",
"url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/0cb03029c7c1c833a11c7bebf30125276f0aa5b9",
"reference": "0cb03029c7c1c833a11c7bebf30125276f0aa5b9",
"shasum": ""
},
"require": {
@ -796,7 +800,7 @@
"keywords": [
"User management"
],
"time": "2013-10-09 22:58:46"
"time": "2013-10-28 10:50:07"
},
{
"name": "gedmo/doctrine-extensions",
@ -1076,6 +1080,117 @@
],
"time": "2013-07-30 22:07:23"
},
{
"name": "hwi/oauth-bundle",
"version": "0.3.0",
"target-dir": "HWI/Bundle/OAuthBundle",
"source": {
"type": "git",
"url": "https://github.com/hwi/HWIOAuthBundle.git",
"reference": "630d61ca64dfcafd02a13b61698fa99d7ec2c74e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hwi/HWIOAuthBundle/zipball/630d61ca64dfcafd02a13b61698fa99d7ec2c74e",
"reference": "630d61ca64dfcafd02a13b61698fa99d7ec2c74e",
"shasum": ""
},
"require": {
"kriswallsmith/buzz": "~0.7",
"php": ">=5.3.3",
"symfony/framework-bundle": "~2.1",
"symfony/options-resolver": "~2.1",
"symfony/security-bundle": "~2.1"
},
"require-dev": {
"doctrine/orm": "~2.2",
"symfony/twig-bundle": "~2.1",
"symfony/validator": "~2.1"
},
"suggest": {
"doctrine/doctrine-bundle": "to use Doctrine user provider",
"friendsofsymfony/user-bundle": "to connect FOSUB with this bundle",
"symfony/twig-bundle": "to use the Twig hwi_oauth_* functions"
},
"type": "symfony-bundle",
"extra": {
"branch-alias": {
"dev-master": "0.3-dev"
}
},
"autoload": {
"psr-0": {
"HWI\\Bundle\\OAuthBundle": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Geoffrey Bachelet",
"email": "geoffrey.bachelet@gmail.com",
"homepage": "https://github.com/ubermuda"
},
{
"name": "Contributors",
"homepage": "https://github.com/hwi/HWIOAuthBundle/contributors"
},
{
"name": "Alexander",
"email": "iam.asm89@gmail.com"
},
{
"name": "Joseph Bielawski",
"email": "stloyd@gmail.com"
}
],
"description": "Support for authenticating users using both OAuth1.0a and OAuth2 in Symfony2.",
"homepage": "http://github.com/hwi/HWIOAuthBundle",
"keywords": [
"37signals",
"Authentication",
"amazon",
"bitbucket",
"bitly",
"box",
"dailymotion",
"deviantart",
"disqus",
"dropbox",
"eventbrite",
"facebook",
"firewall",
"flickr",
"foursquare",
"github",
"google",
"instagram",
"jira",
"linkedin",
"mail.ru",
"oauth",
"oauth1",
"oauth2",
"odnoklassniki",
"qq",
"security",
"sensio connect",
"sina weibo",
"stack exchange",
"stereomood",
"trello",
"twitch",
"twitter",
"vkontakte",
"windows live",
"wordpress",
"yahoo",
"yandex"
],
"time": "2013-09-28 12:37:04"
},
{
"name": "imagine/imagine",
"version": "v0.5.0",
@ -1435,7 +1550,7 @@
],
"authors": [
{
"name": "Johannes Schmitt",
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com",
"homepage": "http://jmsyst.com",
"role": "Developer of wrapped JMSSerializerBundle"
@ -2070,7 +2185,7 @@
"symfony/options-resolver": ">=2.0.16,~2.0"
},
"require-dev": {
"symfony/yaml": ">=2.0.16.0,>=2.0,<3.0",
"symfony/yaml": ">=2.0.16,~2.0",
"twig/twig": ">=1.0,<2.0-dev"
},
"suggest": {
@ -2222,13 +2337,13 @@
"version": "v0.9.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser",
"reference": "v0.9.1"
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "b1cc9ce676b4350b23d0fafc8244d08eee2fe287"
},
"dist": {
"type": "zip",
"url": "https://github.com/nikic/PHP-Parser/archive/v0.9.1.zip",
"reference": "v0.9.1",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/b1cc9ce676b4350b23d0fafc8244d08eee2fe287",
"reference": "b1cc9ce676b4350b23d0fafc8244d08eee2fe287",
"shasum": ""
},
"require": {
@ -2254,7 +2369,7 @@
"parser",
"php"
],
"time": "2012-04-23 15:52:11"
"time": "2012-04-23 22:52:11"
},
{
"name": "omnipay/omnipay",
@ -2530,16 +2645,16 @@
},
{
"name": "payum/payum",
"version": "0.6.0",
"version": "0.6.2",
"source": {
"type": "git",
"url": "https://github.com/Payum/Payum.git",
"reference": "88694b17f075c13be9660cc6465eb0b0b15a440a"
"reference": "a77a6f96316b1e5e168a7fe804284b85c1f58c11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Payum/Payum/zipball/88694b17f075c13be9660cc6465eb0b0b15a440a",
"reference": "88694b17f075c13be9660cc6465eb0b0b15a440a",
"url": "https://api.github.com/repos/Payum/Payum/zipball/a77a6f96316b1e5e168a7fe804284b85c1f58c11",
"reference": "a77a6f96316b1e5e168a7fe804284b85c1f58c11",
"shasum": ""
},
"require": {
@ -2614,7 +2729,7 @@
"paypal rest",
"recurring payment"
],
"time": "2013-10-25 10:22:34"
"time": "2013-10-27 15:45:58"
},
{
"name": "payum/payum-bundle",
@ -2803,13 +2918,13 @@
"version": "1.0.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log",
"reference": "1.0.0"
"url": "https://github.com/php-fig/log.git",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
},
"dist": {
"type": "zip",
"url": "https://github.com/php-fig/log/archive/1.0.0.zip",
"reference": "1.0.0",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
"reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
"shasum": ""
},
"type": "library",
@ -3327,20 +3442,20 @@
},
{
"name": "twig/extensions",
"version": "v1.0.0",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/fabpot/Twig-extensions.git",
"reference": "921799aaf05f88af749d72912d6b154dfeb9a03e"
"reference": "f91a82ec225e5bb108e01a0f93c9be04f84dcfa0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fabpot/Twig-extensions/zipball/921799aaf05f88af749d72912d6b154dfeb9a03e",
"reference": "921799aaf05f88af749d72912d6b154dfeb9a03e",
"url": "https://api.github.com/repos/fabpot/Twig-extensions/zipball/f91a82ec225e5bb108e01a0f93c9be04f84dcfa0",
"reference": "f91a82ec225e5bb108e01a0f93c9be04f84dcfa0",
"shasum": ""
},
"require": {
"twig/twig": "1.*"
"twig/twig": "~1.0"
},
"type": "library",
"extra": {
@ -3370,20 +3485,20 @@
"i18n",
"text"
],
"time": "2013-02-28 14:21:30"
"time": "2013-10-18 19:37:15"
},
{
"name": "twig/twig",
"version": "v1.14.1",
"version": "v1.14.2",
"source": {
"type": "git",
"url": "https://github.com/fabpot/Twig.git",
"reference": "8873d7593ad7c120004f177c0fd01459b383c9cb"
"reference": "ca445842fcea4f844d68203ffa2d00f5e3cdea64"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/fabpot/Twig/zipball/8873d7593ad7c120004f177c0fd01459b383c9cb",
"reference": "8873d7593ad7c120004f177c0fd01459b383c9cb",
"url": "https://api.github.com/repos/fabpot/Twig/zipball/ca445842fcea4f844d68203ffa2d00f5e3cdea64",
"reference": "ca445842fcea4f844d68203ffa2d00f5e3cdea64",
"shasum": ""
},
"require": {
@ -3419,7 +3534,7 @@
"keywords": [
"templating"
],
"time": "2013-10-15 19:17:38"
"time": "2013-10-30 08:20:53"
},
{
"name": "white-october/pagerfanta-bundle",
@ -3428,18 +3543,22 @@
"source": {
"type": "git",
"url": "https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle.git",
"reference": "d02dcf3fb08e57267dfdae73687a20601157e6a5"
"reference": "18ac070194cef0d9e024bec050301cbf3122c787"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/whiteoctober/WhiteOctoberPagerfantaBundle/zipball/d02dcf3fb08e57267dfdae73687a20601157e6a5",
"reference": "d02dcf3fb08e57267dfdae73687a20601157e6a5",
"url": "https://api.github.com/repos/whiteoctober/WhiteOctoberPagerfantaBundle/zipball/18ac070194cef0d9e024bec050301cbf3122c787",
"reference": "18ac070194cef0d9e024bec050301cbf3122c787",
"shasum": ""
},
"require": {
"pagerfanta/pagerfanta": "1.0.*",
"symfony/framework-bundle": "~2.1",
"symfony/property-access": "~2.2"
"symfony/framework-bundle": "~2.2",
"symfony/property-access": "~2.2",
"symfony/twig-bundle": "~2.2"
},
"require-dev": {
"symfony/symfony": "~2.2"
},
"type": "symfony-bundle",
"extra": {
@ -3468,7 +3587,7 @@
"page",
"paging"
],
"time": "2013-09-26 11:26:40"
"time": "2013-10-28 14:55:41"
},
{
"name": "willdurand/negotiation",
@ -3815,28 +3934,28 @@
"time": "2013-06-04 12:18:22"
},
{
"name": "behat/mink-selenium2-driver",
"version": "v1.1.1",
"name": "behat/mink-goutte-driver",
"version": "v1.0.9",
"source": {
"type": "git",
"url": "https://github.com/Behat/MinkSelenium2Driver.git",
"reference": "bcf1b537de37db6db0822d9e7bd97e600fd7a476"
"url": "https://github.com/Behat/MinkGoutteDriver.git",
"reference": "fa1b073b48761464feb0b05e6825da44b20118d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Behat/MinkSelenium2Driver/zipball/bcf1b537de37db6db0822d9e7bd97e600fd7a476",
"reference": "bcf1b537de37db6db0822d9e7bd97e600fd7a476",
"url": "https://api.github.com/repos/Behat/MinkGoutteDriver/zipball/fa1b073b48761464feb0b05e6825da44b20118d8",
"reference": "fa1b073b48761464feb0b05e6825da44b20118d8",
"shasum": ""
},
"require": {
"behat/mink": "~1.5.0",
"instaclick/php-webdriver": "~1.0.12",
"behat/mink-browserkit-driver": ">=1.0.5,<1.2.0",
"fabpot/goutte": "~1.0.1",
"php": ">=5.3.1"
},
"type": "mink-driver",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
"dev-master": "1.0.x-dev"
}
},
"autoload": {
@ -3853,24 +3972,17 @@
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Pete Otaqui",
"email": "pete@otaqui.com",
"homepage": "https://github.com/pete-otaqui"
}
],
"description": "Selenium2 (WebDriver) driver for Mink framework",
"description": "Goutte driver for Mink framework",
"homepage": "http://mink.behat.org/",
"keywords": [
"ajax",
"browser",
"javascript",
"selenium",
"testing",
"webdriver"
"goutte",
"headless",
"testing"
],
"time": "2013-06-02 19:09:45"
"time": "2013-07-03 18:43:54"
},
{
"name": "behat/symfony2-extension",
@ -4042,33 +4154,42 @@
"time": "2013-09-05 11:23:37"
},
{
"name": "friendsofsymfony/rest",
"version": "0.8.0",
"target-dir": "FOS/Rest",
"name": "fabpot/goutte",
"version": "v1.0.3",
"source": {
"type": "git",
"url": "https://github.com/FriendsOfSymfony/FOSRest.git",
"reference": "9a84df8220553e2ae3163b8325a3c4c2e9792426"
"url": "https://github.com/fabpot/Goutte.git",
"reference": "75c9f23c4122caf4ea3e87a42a00b471366e707f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/FriendsOfSymfony/FOSRest/zipball/9a84df8220553e2ae3163b8325a3c4c2e9792426",
"reference": "9a84df8220553e2ae3163b8325a3c4c2e9792426",
"url": "https://api.github.com/repos/fabpot/Goutte/zipball/75c9f23c4122caf4ea3e87a42a00b471366e707f",
"reference": "75c9f23c4122caf4ea3e87a42a00b471366e707f",
"shasum": ""
},
"require": {
"php": ">=5.3.2",
"symfony/http-foundation": "~2.0"
"ext-curl": "*",
"guzzle/http": ">=3.0.5,<3.8-dev",
"php": ">=5.3.0",
"symfony/browser-kit": "~2.1",
"symfony/css-selector": "~2.1",
"symfony/dom-crawler": "~2.1",
"symfony/finder": "~2.1",
"symfony/process": "~2.1"
},
"type": "library",
"require-dev": {
"guzzle/plugin-history": ">=3.0.5,<3.8-dev",
"guzzle/plugin-mock": ">=3.0.5,<3.8-dev"
},
"type": "application",
"extra": {
"branch-alias": {
"dev-master": "0.8.x-dev"
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-0": {
"FOS\\Rest": ""
"Goutte": "."
}
},
"notification-url": "https://packagist.org/downloads/",
@ -4077,20 +4198,16 @@
],
"authors": [
{
"name": "Lukas Kahwe Smith",
"email": "smith@pooteeweet.org"
},
{
"name": "FriendsOfSymfony Community",
"homepage": "https://github.com/FriendsOfSymfony/FOSRest/contributors"
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"description": "This library provides various tools to develop RESTful API's",
"homepage": "http://friendsofsymfony.github.com",
"description": "A simple PHP Web Scraper",
"homepage": "https://github.com/fabpot/Goutte",
"keywords": [
"rest"
"scraper"
],
"time": "2013-03-02 20:35:05"
"time": "2013-08-16 06:03:22"
},
{
"name": "fzaninotto/faker",
@ -4138,76 +4255,18 @@
],
"time": "2013-06-09 18:05:57"
},
{
"name": "instaclick/php-webdriver",
"version": "1.0.17",
"source": {
"type": "git",
"url": "https://github.com/instaclick/php-webdriver.git",
"reference": "47a6019553a7a5b42d35493276ffc2c9252c53d5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/instaclick/php-webdriver/zipball/47a6019553a7a5b42d35493276ffc2c9252c53d5",
"reference": "47a6019553a7a5b42d35493276ffc2c9252c53d5",
"shasum": ""
},
"require": {
"ext-curl": "*",
"php": ">=5.3.2"
},
"bin": [
"bin/webunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-0": {
"WebDriver": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Justin Bishop",
"email": "jubishop@gmail.com",
"role": "Developer"
},
{
"name": "Anthon Pang",
"email": "apang@softwaredevelopment.ca",
"role": "Fork Maintainer"
}
],
"description": "PHP WebDriver for Selenium 2",
"homepage": "http://instaclick.com/",
"keywords": [
"browser",
"selenium",
"webdriver",
"webtest"
],
"time": "2013-10-04 15:03:51"
},
{
"name": "phpspec/php-diff",
"version": "v1.0.1",
"source": {
"type": "git",
"url": "https://github.com/phpspec/php-diff.git",
"reference": "v1.0.1"
"reference": "8d82ac415225fac373a4073ba14b1fe286aa2312"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/php-diff/zipball/v1.0.1",
"reference": "v1.0.1",
"url": "https://api.github.com/repos/phpspec/php-diff/zipball/8d82ac415225fac373a4073ba14b1fe286aa2312",
"reference": "8d82ac415225fac373a4073ba14b1fe286aa2312",
"shasum": ""
},
"type": "library",
@ -4235,12 +4294,12 @@
"source": {
"type": "git",
"url": "https://github.com/phpspec/phpspec.git",
"reference": "d8f64251d27dc1bb17b76608d620374b6b51f9ff"
"reference": "ce8b573e1c0a9a31bc40e8005683ba8117ca1a32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/phpspec/zipball/d8f64251d27dc1bb17b76608d620374b6b51f9ff",
"reference": "d8f64251d27dc1bb17b76608d620374b6b51f9ff",
"url": "https://api.github.com/repos/phpspec/phpspec/zipball/ce8b573e1c0a9a31bc40e8005683ba8117ca1a32",
"reference": "ce8b573e1c0a9a31bc40e8005683ba8117ca1a32",
"shasum": ""
},
"require": {
@ -4295,7 +4354,7 @@
"testing",
"tests"
],
"time": "2013-10-04 08:02:36"
"time": "2013-10-21 19:22:09"
},
{
"name": "phpspec/prophecy",

View file

@ -8,8 +8,12 @@ Feature: Sign in to the store via OAuth
Given I am not logged in
And I am on the store homepage
Scenario: Get to the OAuth login page
Scenario Outline: Get to the OAuth login page
When I follow "Login"
And I press the login with Amazon button
Then I should be on the amazon.com website
And I should see the Amazon login form
Then I should see the connect with "<oauth>" button
Examples:
| oauth |
| Amazon |
| Facebook |
| Google |

View file

@ -11,6 +11,7 @@
namespace Sylius\Bundle\CoreBundle\OAuth;
use FOS\UserBundle\Model\UserInterface as FOSUserInterface;
use HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface;
use HWI\Bundle\OAuthBundle\Security\Core\User\FOSUBUserProvider;
use Sylius\Bundle\CoreBundle\Model\User;
@ -34,11 +35,10 @@ class UserProvider extends FOSUBUserProvider
} catch (UsernameNotFoundException $e) {
if (null === $user = $this->userManager->findUserByEmail($response->getEmail())) {
return $this->createUserByOAuthUserResponse($response);
} else {
return $this->updateUserByOAuthUserResponse($user, $response);
}
}
return $this->updateUserByOAuthUserResponse($user, $response);
}
}
/**
@ -69,6 +69,7 @@ class UserProvider extends FOSUBUserProvider
if (null !== $email = $response->getEmail()) {
$user->setEmail($email);
}
if (null === $this->userManager->findUserByUsername($response->getNickname())) {
$user->setUsername($response->getNickname());
}
@ -81,12 +82,12 @@ class UserProvider extends FOSUBUserProvider
/**
* Attach OAuth sign-in provider account to existing user
*
* @param User $user
* @param FOSUserInterface $user
* @param UserResponseInterface $response
*
* @return User
* @return FOSUserInterface
*/
protected function updateUserByOAuthUserResponse(User $user, UserResponseInterface $response)
protected function updateUserByOAuthUserResponse(FOSUserInterface $user, UserResponseInterface $response)
{
$providerName = $response->getResourceOwner()->getName();
$providerNameSetter = 'set'.ucfirst($providerName).'Id';

View file

@ -30,39 +30,10 @@ class OAuthContext extends RawMinkContext
}
/**
* @Then /^I should be on the (.+) website$/
* @Then /^I should see the connect with "([^""]*)" button$/
*/
public function iShouldBeOnTheWebsite($domain)
public function iShouldSeeTheConnectWithButton($connect)
{
if (!$this->currentUrlContains($domain)) {
throw new ExpectationException(sprintf('Current URL should contain "%s".', $domain), $this->getSession());
}
}
/**
* @Then /^I should see the .+ login form$/
*/
public function iShouldSeeTheLoginForm()
{
$loginForm = $this->getLoginForm();
// Re-set default session
$this->getMink()->setDefaultSessionName('symfony2');
}
protected function currentUrlContains($domain)
{
$currentUrl = $this->getSession()->getCurrentUrl();
return strpos($currentUrl, $domain) !== false;
}
protected function getLoginForm()
{
return $this->assertSession()->elementExists('xpath',
'//form//input[@type="email"]' .
'/ancestor::form//input[@type="password"]' .
'/ancestor::form//*[@type="submit"]' .
'/ancestor::form'
);
$this->assertSession()->elementExists('css', sprintf('.oauth-login-%s', strtolower($connect)));
}
}