Skip to content

Commit 7304a82

Browse files
Initial commit
0 parents  commit 7304a82

File tree

8 files changed

+146
-0
lines changed

8 files changed

+146
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/
2+
composer.lock

LICENSE.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
MIT License
2+
Copyright (c) 2016 Protech Studio di Laera Vito
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5+
6+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7+
8+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

composer.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "protechstudio/laravel-prestashop-webservice",
3+
"description": "Laravel 5 wrapper for Prestashop Web Service Library",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Vito Laera",
8+
"email": "vito.laera@protechstudio.it"
9+
}
10+
],
11+
"autoload": {
12+
"psr-4": {
13+
"Protechstudio\\PrestashopWebService\\": "src/"
14+
}
15+
},
16+
"require": {
17+
"prestashop/prestashop-webservice-lib": "dev-master"
18+
}
19+
}

phpunit.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="../../../bootstrap/autoload.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false">
12+
<testsuites>
13+
<testsuite name="Prestashop Web Service Test Suite">
14+
<directory>./tests/</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">app/</directory>
20+
</whitelist>
21+
</filter>
22+
<php>
23+
<env name="APP_ENV" value="testing"/>
24+
<env name="CACHE_DRIVER" value="array"/>
25+
<env name="SESSION_DRIVER" value="array"/>
26+
<env name="QUEUE_DRIVER" value="sync"/>
27+
</php>
28+
</phpunit>

src/PrestashopWebServiceFacade.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
namespace Protechstudio\PrestashopWebService;
4+
5+
6+
use Illuminate\Support\Facades\Facade;
7+
use PrestaShopWebservice;
8+
9+
class PrestashopWebServiceFacade extends Facade
10+
{
11+
12+
protected static function getFacadeAccessor()
13+
{
14+
return PrestaShopWebservice::class;
15+
}
16+
17+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
namespace Protechstudio\PrestashopWebService;
4+
5+
use Illuminate\Support\ServiceProvider;
6+
use PrestaShopWebservice;
7+
8+
class PrestashopWebServiceProvider extends ServiceProvider
9+
{
10+
11+
/**
12+
* Bootstrap the application services.
13+
*
14+
* @return void
15+
*/
16+
public function boot()
17+
{
18+
$this->publish();
19+
}
20+
21+
/**
22+
* Register the application services.
23+
*
24+
* @return void
25+
*/
26+
public function register()
27+
{
28+
$this->registerConfig();
29+
30+
$this->app->singleton(PrestaShopWebservice::class, function () {
31+
return new PrestaShopWebservice(config('prestashop-webservice.url'),
32+
config('prestashop-webservice.token', config('prestashop-webservice.debug')));
33+
});
34+
}
35+
36+
private function publish()
37+
{
38+
$this->publishes([
39+
__DIR__ . '/config.php' => config_path('prestashop-webservice.php'),
40+
], 'config');
41+
42+
}
43+
44+
private function registerConfig()
45+
{
46+
$this->mergeConfigFrom(__DIR__ . '/config.php', 'prestashop-webservice');
47+
}
48+
}

src/config.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
return [
4+
'url' => 'http://domain.com',
5+
'token' => '',
6+
'debug' => env('APP_DEBUG', false)
7+
];

tests/PrestashopWebServiceTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
3+
use Illuminate\Foundation\Testing\WithoutMiddleware;
4+
use Illuminate\Foundation\Testing\DatabaseMigrations;
5+
use Illuminate\Foundation\Testing\DatabaseTransactions;
6+
7+
class PrestashopWebServiceTest extends TestCase
8+
{
9+
10+
/**
11+
* @test
12+
*/
13+
public function it_is_correctly_installed()
14+
{
15+
$this->assertInstanceOf(PrestaShopWebservice::class, Prestashop::getFacadeRoot());
16+
}
17+
}

0 commit comments

Comments
 (0)