Issues (281)

src/Behat/Context/ApiContext.php (2 issues)

1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Behat\Context;
12
13
use Behat\Behat\Context\Context;
14
use Doctrine\Bundle\DoctrineBundle\Registry;
15
use Symfony\Component\DependencyInjection\ContainerInterface;
16
use Symfony\Component\HttpFoundation\Response;
17
use Ynlo\GraphQLBundle\Behat\Client\ClientAwareInterface;
18
use Ynlo\GraphQLBundle\Behat\Client\ClientAwareTrait;
19
use Ynlo\GraphQLBundle\Behat\Storage\StorageAwareInterface;
20
use Ynlo\GraphQLBundle\Behat\Storage\StorageAwareTrait;
21
22
/**
23
 * Should be used as base class for API tests,
24
 * provide some helpful methods and direct access to de client
25
 */
26
class ApiContext implements Context, ClientAwareInterface, StorageAwareInterface
27
{
28
    use ClientAwareTrait;
29
    use StorageAwareTrait;
30
31
    public function getRepose(): Response
32
    {
33
        return $this->client->getResponse();
34
    }
35
36
    public function getContainer(): ContainerInterface
37
    {
38
        return $this->client->getContainer();
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->client->getContainer() could return the type null which is incompatible with the type-hinted return Symfony\Component\Depend...tion\ContainerInterface. Consider adding an additional type-check to rule them out.
Loading history...
39
    }
40
41
    public function getDoctrine(): Registry
42
    {
43
        return $this->getContainer()->get('doctrine');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getContainer()->get('doctrine') could return the type null which is incompatible with the type-hinted return Doctrine\Bundle\DoctrineBundle\Registry. Consider adding an additional type-check to rule them out.
Loading history...
44
    }
45
}
46