forked from mautic/mautic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing failing API-Library test for editing devices by PUT with ID th…
…at does not work TypeError: method_exists(): Argument #1 ($object_or_class) must be of type object|string, null given
- Loading branch information
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
app/bundles/LeadBundle/Tests/Controller/Api/DeviceApiControllerFunctionalTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mautic\LeadBundle\Tests\Controller\Api; | ||
|
||
use Mautic\CoreBundle\Test\MauticMysqlTestCase; | ||
use Mautic\LeadBundle\Entity\Lead; | ||
use PHPUnit\Framework\Assert; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
class DeviceApiControllerFunctionalTest extends MauticMysqlTestCase | ||
{ | ||
public function testPutEditWithInexistingIdSoItShouldCreate(): void | ||
{ | ||
$contact = new Lead(); | ||
$this->em->persist($contact); | ||
$this->em->flush(); | ||
|
||
$this->client->request(Request::METHOD_PUT, '/api/devices/99999/edit', [ | ||
'device' => 'desktop', | ||
'deviceOsName' => 'Ubuntu', | ||
'deviceOsShortName' => 'UBT', | ||
'deviceOsPlatform' => 'x64', | ||
'lead' => $contact->getId(), | ||
]); | ||
|
||
$clientResponse = $this->client->getResponse(); | ||
|
||
Assert::assertSame(Response::HTTP_CREATED, $clientResponse->getStatusCode()); | ||
} | ||
} |