Conditions | 1 |
Paths | 1 |
Total Lines | 38 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
9 | public function testQuery() |
||
10 | { |
||
11 | $designDocPath = __DIR__ . "/../../../Models/CMS/_files"; |
||
12 | $this->dm = $this->createDocumentManager(); |
||
13 | $this->dm->getConfiguration() |
||
14 | ->addDesignDocument('cms', 'Doctrine\CouchDB\View\FolderDesignDocument', $designDocPath); |
||
|
|||
15 | |||
16 | $user1 = new \Doctrine\Tests\Models\CMS\CmsUser(); |
||
17 | $user1->username = "beberlei"; |
||
18 | $user1->status = "active"; |
||
19 | $user1->name = "Benjamin"; |
||
20 | |||
21 | $user2 = new \Doctrine\Tests\Models\CMS\CmsUser(); |
||
22 | $user2->username = "lsmith"; |
||
23 | $user2->status = "active"; |
||
24 | $user2->name = "Lukas"; |
||
25 | |||
26 | $this->dm->persist($user1); |
||
27 | $this->dm->persist($user2); |
||
28 | $this->dm->flush(); |
||
29 | $this->dm->clear(); |
||
30 | |||
31 | $result = $this->dm->createQuery('cms', 'username') |
||
32 | ->onlyDocs(true) |
||
33 | ->setKey('lsmith') |
||
34 | ->execute(); |
||
35 | |||
36 | $this->assertCount(1, $result); |
||
37 | $this->assertEquals('lsmith', $result[0]->username); |
||
38 | |||
39 | $result = $this->dm->createQuery('cms', 'username') |
||
40 | ->onlyDocs(true) |
||
41 | ->setKey('beberlei') |
||
42 | ->execute(); |
||
43 | |||
44 | $this->assertCount(1, $result); |
||
45 | $this->assertEquals('beberlei', $result[0]->username); |
||
46 | } |
||
47 | } |
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: