diff --git a/examples/logotipo.png b/examples/logotipo.png new file mode 100644 index 0000000..ad8255a Binary files /dev/null and b/examples/logotipo.png differ diff --git a/src/Interfaces/ILogotipo.php b/src/Interfaces/ILogotipo.php new file mode 100644 index 0000000..7231f6e --- /dev/null +++ b/src/Interfaces/ILogotipo.php @@ -0,0 +1,10 @@ +file = [ + 'name' => 'arquivo', + 'contents' => file_get_contents($splFileObject->getPathName()), + 'filename' => $fileNameWithExtension + ]; + } + + public function getFile() + { + return $this->file; + } + + public function create($cnpj, Configuration $configuration) + { + $communication = $this->getCallApiInstance($configuration); + return $communication->sendWithFiles('POST', "/empresa/${cnpj}/logotipo", $this->toArray()); + } +} diff --git a/tests/LogotipoTest.php b/tests/LogotipoTest.php new file mode 100644 index 0000000..78283f9 --- /dev/null +++ b/tests/LogotipoTest.php @@ -0,0 +1,26 @@ +setFile(__DIR__.'/../examples/logotipo.png', 'logotipo.png'); + + $cnpj = '08187168000160'; + $response = $logotipo->create($cnpj, $configuration); + + $this->assertEquals(200, $response->statusCode); + $this->assertObjectHasAttribute('message', $response->body); + $this->assertSame('Upload realizado com sucesso', $response->body->message); + } +}