Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install the dependencies on a Laravel 5.6 project #80

Open
programarivm opened this issue Jul 24, 2018 · 4 comments
Open

Can't install the dependencies on a Laravel 5.6 project #80

programarivm opened this issue Jul 24, 2018 · 4 comments

Comments

@programarivm
Copy link

programarivm commented Jul 24, 2018

When pulling the dependencies through Composer:

composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension symfony/dependency-injection:"3.*" --dev

I got the output:

Using version ^3.4 for behat/behat
Using version ^1.7 for behat/mink
Using version ^2.3 for behat/mink-extension
Using version ^1.1 for laracasts/behat-laravel-extension
./composer.json has been updated
Cannot create cache directory /home/standard/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/standard/.composer/cache/files/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/standard/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install symfony/dependency-injection v3.4.13
    - Conclusion: don't install symfony/dependency-injection v3.4.12
    - Conclusion: don't install symfony/dependency-injection v3.4.11
    - Conclusion: don't install symfony/dependency-injection v3.4.10
    - Conclusion: don't install symfony/dependency-injection v3.4.9
    - Conclusion: don't install symfony/dependency-injection v3.4.8
    - Conclusion: don't install symfony/dependency-injection v3.4.7
    - Conclusion: don't install symfony/dependency-injection v3.4.6
    - Conclusion: don't install symfony/dependency-injection v3.4.5
    - Conclusion: don't install symfony/dependency-injection v3.4.4
    ...

The following workaround seems to do the trick:

composer require behat/behat behat/mink behat/mink-extension laracasts/behat-laravel-extension symfony/dependency-injection:"4.*" --dev

However I feel as if jumping into the unknown as described at Behat/Behat#1108. Can laracasts/Behat-Laravel-Extension be used with Laravel 5.6?

@philtweir
Copy link
Contributor

At the moment, I think you'd need to use these changes (or something similar) to get L5.6 deps working right with Behat. I have been doing so for a couple weeks now, and it seems fine.

However, until Behat/Behat#1163 is merged, you would also need to use the flaxandteal/Behat branch referenced there for Behat.

I haven't PR'd on this repo yet, pending Behat/Behat#1163 (as it's only useful as a pair), but they are not actually interdepedent, so I can set up a PR here and get the ball rolling?

@programarivm
Copy link
Author

Thank you @philtweir! I finally managed to set up Behat for L5.6 without the extension. My Behat tests can interact with the database using Capsule as explained here.

@programarivm
Copy link
Author

programarivm commented Jul 28, 2018

Btw, here is a basic example on how to use Behat for L5.6 with Capsule :)

<?php

use App\Utils\SingleManning;
use Dotenv\Dotenv;
use Illuminate\Database\Capsule\Manager as Capsule;

abstract class AbstractRotaContext
{
    protected $capsule;

    protected $singleManning;

    protected $rotaId;

    public function __construct($rotaId)
    {
        $dotenv = new Dotenv(__DIR__.'/../../');
        $dotenv->load();

        $this->capsule = new Capsule;

        $this->capsule->addConnection([
            'driver'    => 'mysql',
            'host'      => getenv('DB_HOST'),
            'database'  => getenv('DB_DATABASE'),
            'username'  => getenv('DB_USERNAME'),
            'password'  => getenv('DB_PASSWORD'),
        ]);

        $this->capsule->setAsGlobal();
        $this->capsule->bootEloquent();

        $this->singleManning = new SingleManning($this->capsule);

        $this->rotaId = $rotaId;
    }

    protected function works($firstName, $start)
    {
        $pdo = Capsule::connection()->getPdo();

        $stm = $pdo->prepare(
            'SELECT * FROM shifts AS sh
                JOIN staff as st ON sh.staff_id = st.id
                WHERE DATE(sh.start_time) = :start
                AND st.first_name = :firstName');

        $stm->execute(
            [
                ':start' => $start,
                ':firstName' => $firstName
            ]
        );

        return $stm->rowCount() === 1;
    }
    ...
}

@philtweir
Copy link
Contributor

Cool! That's a really nice option, especially as I can see it often being a better match than the spinning up all the non-DB utils - may take a look at the approach in general for some of our needs. Just as an update for those who have slightly more specific reqs (e.g. our team's API testing plugin), #81 should address the underlying bug.

alnutile added a commit that referenced this issue Oct 31, 2018
…ravel-56

Fix for #78 (also linked to #80): Update to be compatible with Laravel 5.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants