|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Sonata\DoctrinePHPCRAdminBundle\Tests\WebTest\Admin; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Cmf\Component\Testing\Functional\BaseTestCase; |
|
6
|
|
|
|
|
7
|
|
|
class ContentAdminTest extends BaseTestCase |
|
8
|
|
|
{ |
|
9
|
|
|
public function setUp() |
|
10
|
|
|
{ |
|
11
|
|
|
$this->db('PHPCR')->loadFixtures(array('Sonata\DoctrinePHPCRAdminBundle\Tests\Resources\DataFixtures\Phpcr\LoadAssociationData')); |
|
12
|
|
|
$this->client = $this->createClient(); |
|
13
|
|
|
} |
|
14
|
|
|
|
|
15
|
|
|
public function testContentList() |
|
16
|
|
|
{ |
|
17
|
|
|
$crawler = $this->client->request('GET', '/admin/tests/resources/content/list'); |
|
18
|
|
|
$res = $this->client->getResponse(); |
|
19
|
|
|
|
|
20
|
|
|
$this->assertResponseSuccess($res); |
|
21
|
|
|
$this->assertCount(1, $crawler->filter('html:contains("Content 1")')); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
public function testContentEdit() |
|
25
|
|
|
{ |
|
26
|
|
|
$crawler = $this->client->request('GET', '/admin/tests/resources/content/test/content/content-1/edit'); |
|
27
|
|
|
$res = $this->client->getResponse(); |
|
28
|
|
|
|
|
29
|
|
|
$this->assertResponseSuccess($res); |
|
30
|
|
|
$this->assertCount(1, $crawler->filter('input[value="content-1"]')); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function testContentCreate() |
|
34
|
|
|
{ |
|
35
|
|
|
$crawler = $this->client->request('GET', '/admin/tests/resources/content/create'); |
|
36
|
|
|
$res = $this->client->getResponse(); |
|
37
|
|
|
$this->assertResponseSuccess($res); |
|
38
|
|
|
|
|
39
|
|
|
$button = $crawler->selectButton('Create'); |
|
40
|
|
|
$form = $button->form(); |
|
41
|
|
|
$node = $form->getFormNode(); |
|
42
|
|
|
$actionUrl = $node->getAttribute('action'); |
|
43
|
|
|
$uniqId = substr(strstr($actionUrl, '='), 1); |
|
44
|
|
|
|
|
45
|
|
|
$form[$uniqId.'[parentDocument]'] = '/test/content'; |
|
46
|
|
|
$form[$uniqId.'[name]'] = 'foo-test'; |
|
47
|
|
|
$form[$uniqId.'[title]'] = 'Foo Test'; |
|
48
|
|
|
|
|
49
|
|
|
$this->client->submit($form); |
|
|
|
|
|
|
50
|
|
|
$res = $this->client->getResponse(); |
|
51
|
|
|
|
|
52
|
|
|
// If we have a 302 redirect, then all is well |
|
53
|
|
|
$this->assertEquals(302, $res->getStatusCode()); |
|
54
|
|
|
} |
|
55
|
|
|
} |
|
56
|
|
|
|
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: