Skip to content
This repository was archived by the owner on Apr 29, 2025. It is now read-only.

Application service injection #70

Merged
merged 7 commits into from
Sep 4, 2014
Merged

Application service injection #70

merged 7 commits into from
Sep 4, 2014

Conversation

everzet
Copy link
Member

@everzet everzet commented Sep 4, 2014

Reusing container in your smoke tests FTW:

default:
    suites:
        default:
            type: symfony_bundle
            contexts:
                - Behat\Sf2DemoBundle\Features\Context\FeatureContext:
                    simpleArg: 'string'
                    session:   @session
            bundle: 'BehatSf2DemoBundle'
    extensions:
        Behat\Symfony2Extension: ~
<?php

namespace Behat\Sf2DemoBundle\Features\Context;

use Behat\Behat\Context\Context;
use Symfony\Component\HttpFoundation\Session\Session;

class FeatureContext implements Context
{
    public function __construct(Session $session, $simpleArg)
    {
        // $session is your Symfony2 @session
    }
}

everzet added a commit that referenced this pull request Sep 4, 2014
@everzet everzet merged commit 815ec1f into master Sep 4, 2014
@everzet everzet deleted the feature/service-injection branch September 4, 2014 22:10
return $argument;
}

$serviceId = mb_substr($argument, 1, mb_strlen($argument, 'utf8'), 'utf8');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could just use substr($argument, 1) given that you know that the first char is not a multibyte one anyway

@ciaranmcnulty
Copy link
Contributor

Wait so I don't need KernelAwareContext to access the Container? 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants