Completed
Push — master ( f71d4e...c66cbf )
by
unknown
08:22 queued 01:15
created

ApiBundle/Controller/ContentControllerTest.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace OpenOrchestra\FunctionalTests\ApiBundle\Controller;
4
5
use OpenOrchestra\FunctionalTests\Utils\AbstractAuthenticatedTest;
6
use OpenOrchestra\ModelInterface\Repository\ContentRepositoryInterface;
7
use OpenOrchestra\ModelInterface\Repository\StatusRepositoryInterface;
8
9
/**
10
 * Class ContentControllerTest
11
 */
12
class ContentControllerTest extends AbstractAuthenticatedTest
13
{
14
    /**
15
     * @var StatusRepositoryInterface
16
     */
17
    protected $statusRepository;
18
19
    /**
20
     * @var ContentRepositoryInterface
21
     */
22
    protected $contentRepository;
23
24
    /**
25
     * Set up the test
26
     */
27
    public function setUp()
28
    {
29
        parent::setUp();
30
        $this->contentRepository = static::$kernel->getContainer()->get('open_orchestra_model.repository.content');
31
        $this->statusRepository = static::$kernel->getContainer()->get('open_orchestra_model.repository.status');
32
    }
33
34
    /**
35
     * @param string $name
36
     * @param bool   $published
37
     *
38
     * @dataProvider provideStatusName
39
     */
40
    public function testChangeContentStatus($name, $published)
41
    {
42
        $this->markTestSkipped('To reactivate when API roles will be implemented');
43
44
        $content = $this->contentRepository->findOneByLanguageAndVersion('206_3_portes', 'fr', 2);
45
        $newStatus = $this->statusRepository->findOneByName($name);
0 ignored issues
show
The method findOneByName() does not seem to exist on object<OpenOrchestra\Mod...tusRepositoryInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
46
        $newStatusId = $newStatus->getId();
47
48
        $this->client->request(
49
            'POST',
50
            '/api/content/' . $content->getId() . '/update',
51
            array(),
52
            array(),
53
            array(),
54
            json_encode(array('status_id' => $newStatusId))
55
        );
56
57
        $this->assertSame(200, $this->client->getResponse()->getStatusCode());
58
59
        $newContent = $this->contentRepository->findOneByLanguageAndVersion('206_3_portes', 'fr', 2);
60
        $this->assertSame($published, $newContent->getStatus()->isPublishedState());
61
    }
62
63
    /**
64
     * @return array
65
     */
66
    public function provideStatusName()
67
    {
68
        return array(
69
            array('draft', false),
70
            array('pending', false),
71
            array('published', true),
72
        );
73
    }
74
}
75