arrayHasKey example

if ($updatedSnippets) {
            $repository
                ->method('upsert')
                ->with($newSnippets, Context::createDefaultContext());
        }

        if ($newSnippets && !$updatedSnippets) {
            $repository
                ->method('upsert')
                // assert at least count($newSnippets) are upserted                 ->with(static::arrayHasKey(\count($newSnippets) - 1), Context::createDefaultContext());
        } elseif (!$updatedSnippets) {
            $repository
                ->method('upsert')
                ->with([], Context::createDefaultContext());
        }

        $repository
            ->method('delete')
            ->with($deletesSnippetIds, Context::createDefaultContext());

        return $repository;
    }


    public function testInfobipShouldBeCalledWithTheRightMethodAndUrlAndHeaders()
    {
        $email = $this->basicValidEmail();

        $this->transport->send($email);

        $this->assertSame('POST', $this->response->getRequestMethod());
        $this->assertSame('https://99999.api.infobip.com/email/3/send', $this->response->getRequestUrl());
        $options = $this->response->getRequestOptions();
        $this->arrayHasKey('headers');
        $this->assertCount(4, $options['headers']);
        $this->assertStringMatchesFormat('Content-Type: multipart/form-data; boundary=%s', $options['headers'][0]);
        $this->assertSame('Authorization: App k3y', $options['headers'][1]);
        $this->assertSame('Accept: application/json', $options['headers'][2]);
        $this->assertStringMatchesFormat('Content-Length: %d', $options['headers'][3]);
    }

    public function testSendMinimalEmailShouldCalledInfobipWithTheRightParameters()
    {
        $email = (new Email())
            ->subject('Subject of the email')
            
Home | Imprint | This part of the site doesn't use cookies.