1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Sonata\DoctrinePHPCRAdminBundle\Tests\WebTest\Admin; |
4
|
|
|
|
5
|
|
|
use Sonata\DoctrinePHPCRAdminBundle\Tests\Resources\DataFixtures\Phpcr\LoadAssociationData; |
6
|
|
|
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase; |
7
|
|
|
|
8
|
|
|
class StaticContentAdminTest extends BaseTestCase |
9
|
|
|
{ |
10
|
|
|
public function setUp() |
11
|
|
|
{ |
12
|
|
|
$this->db('PHPCR')->loadFixtures([LoadAssociationData::class]); |
13
|
|
|
$this->client = $this->createClient(); |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
public function testContentList() |
17
|
|
|
{ |
18
|
|
|
$crawler = $this->client->request('GET', '/admin/tests/resources/content/list'); |
19
|
|
|
$res = $this->client->getResponse(); |
20
|
|
|
|
21
|
|
|
$this->assertResponseSuccess($res); |
22
|
|
|
$this->assertCount(1, $crawler->filter('html:contains("Content 1")')); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function testContentEdit() |
26
|
|
|
{ |
27
|
|
|
$crawler = $this->client->request('GET', '/admin/tests/resources/content/test/content/content-1/edit'); |
28
|
|
|
$res = $this->client->getResponse(); |
29
|
|
|
|
30
|
|
|
$this->assertResponseSuccess($res); |
31
|
|
|
$this->assertCount(1, $crawler->filter('input[value="content-1"]')); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
public function testContentCreate() |
35
|
|
|
{ |
36
|
|
|
$crawler = $this->client->request('GET', '/admin/tests/resources/content/create'); |
37
|
|
|
$res = $this->client->getResponse(); |
38
|
|
|
$this->assertResponseSuccess($res); |
39
|
|
|
|
40
|
|
|
$button = $crawler->selectButton('Create'); |
41
|
|
|
$form = $button->form(); |
42
|
|
|
$node = $form->getFormNode(); |
43
|
|
|
$actionUrl = $node->getAttribute('action'); |
44
|
|
|
$uniqId = substr(strstr($actionUrl, '='), 1); |
45
|
|
|
|
46
|
|
|
$form[$uniqId.'[parentDocument]'] = '/test/content'; |
47
|
|
|
$form[$uniqId.'[name]'] = 'foo-test'; |
48
|
|
|
$form[$uniqId.'[title]'] = 'Foo Test'; |
49
|
|
|
|
50
|
|
|
$this->client->submit($form); |
|
|
|
|
51
|
|
|
$res = $this->client->getResponse(); |
52
|
|
|
|
53
|
|
|
// If we have a 302 redirect, then all is well |
54
|
|
|
$this->assertEquals(302, $res->getStatusCode()); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: