-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from rossjcooper/feature/php-cs-fixer
Feature/php cs fixer
- Loading branch information
Showing
11 changed files
with
167 additions
and
156 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
composer.lock | ||
.DS_Store | ||
.env | ||
.phpunit.result.cache | ||
.phpunit.result.cache | ||
.php_cs.cache |
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,17 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->exclude('vendor') | ||
->in(__DIR__) | ||
; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@PSR2' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
]) | ||
->setIndent("\t") | ||
->setLineEnding("\r\n") | ||
->setFinder($finder) | ||
; |
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
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
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 |
---|---|---|
@@ -1,15 +1,18 @@ | ||
<?php | ||
|
||
namespace Rossjcooper\LaravelHubSpot\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class HubSpot extends Facade | ||
{ | ||
/** | ||
* Get the registered name of the component. | ||
* | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor() { return 'Rossjcooper\LaravelHubSpot\HubSpot'; } | ||
} | ||
<?php | ||
|
||
namespace Rossjcooper\LaravelHubSpot\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
class HubSpot extends Facade | ||
{ | ||
/** | ||
* Get the registered name of the component. | ||
* | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'Rossjcooper\LaravelHubSpot\HubSpot'; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
<?php | ||
|
||
namespace Rossjcooper\LaravelHubSpot; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
use SevenShores\Hubspot\Factory as Factory; | ||
|
||
class HubSpot extends Factory | ||
{ | ||
|
||
} | ||
<?php | ||
|
||
namespace Rossjcooper\LaravelHubSpot; | ||
|
||
use SevenShores\Hubspot\Factory as Factory; | ||
|
||
class HubSpot extends Factory | ||
{ | ||
} |
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 |
---|---|---|
@@ -1,40 +1,34 @@ | ||
<?php | ||
|
||
namespace Rossjcooper\LaravelHubSpot; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
use Rossjcooper\LaravelHubSpot\HubSpot; | ||
|
||
class HubSpotServiceProvider extends ServiceProvider | ||
{ | ||
|
||
/** | ||
* Register the service provider. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
//Bind the HubSpot wrapper class | ||
$this->app->bind('Rossjcooper\LaravelHubSpot\HubSpot', function ($app) { | ||
return HubSpot::create( | ||
env('HUBSPOT_API_KEY', config('hubspot.api_key')), | ||
null, | ||
config('hubspot.client_options', []) | ||
); | ||
}); | ||
} | ||
|
||
/** | ||
* Perform post-registration booting of services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
// config | ||
$this->publishes([ | ||
__DIR__ . '/config/hubspot.php' => config_path('hubspot.php') | ||
], 'config'); | ||
} | ||
} | ||
<?php | ||
|
||
namespace Rossjcooper\LaravelHubSpot; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class HubSpotServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Register the service provider. | ||
*/ | ||
public function register() | ||
{ | ||
//Bind the HubSpot wrapper class | ||
$this->app->bind('Rossjcooper\LaravelHubSpot\HubSpot', function ($app) { | ||
return HubSpot::create( | ||
env('HUBSPOT_API_KEY', config('hubspot.api_key')), | ||
null, | ||
config('hubspot.client_options', []) | ||
); | ||
}); | ||
} | ||
|
||
/** | ||
* Perform post-registration booting of services. | ||
*/ | ||
public function boot() | ||
{ | ||
// config | ||
$this->publishes([ | ||
__DIR__.'/config/hubspot.php' => config_path('hubspot.php'), | ||
], 'config'); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
'api_key' => env('HUBSPOT_API_KEY'), | ||
|
||
'client_options' => [ | ||
'http_errors' => true, | ||
], | ||
|
||
]; | ||
<?php | ||
|
||
return [ | ||
'api_key' => env('HUBSPOT_API_KEY'), | ||
|
||
'client_options' => [ | ||
'http_errors' => true, | ||
], | ||
]; |
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 |
---|---|---|
@@ -1,24 +1,23 @@ | ||
<?php | ||
|
||
namespace Tests\API; | ||
|
||
use Tests\TestCase; | ||
use Rossjcooper\LaravelHubSpot\HubSpot; | ||
|
||
class ContactsTest extends TestCase | ||
{ | ||
|
||
public function test_get_contacts() | ||
{ | ||
$hubspot = app(HubSpot::class); | ||
|
||
$response = $hubspot->contacts()->all(); | ||
|
||
$contact = $response->contacts[0]; | ||
|
||
$this->assertIsArray($response->contacts); | ||
// Test we have the default test contact | ||
$this->assertEquals('Cool', $contact->properties->firstname->value); | ||
$this->assertEquals('Robot (Sample Contact)', $contact->properties->lastname->value); | ||
} | ||
} | ||
<?php | ||
|
||
namespace Tests\API; | ||
|
||
use Tests\TestCase; | ||
use Rossjcooper\LaravelHubSpot\HubSpot; | ||
|
||
class ContactsTest extends TestCase | ||
{ | ||
public function test_get_contacts() | ||
{ | ||
$hubspot = app(HubSpot::class); | ||
|
||
$response = $hubspot->contacts()->all(); | ||
|
||
$contact = $response->contacts[0]; | ||
|
||
$this->assertIsArray($response->contacts); | ||
// Test we have the default test contact | ||
$this->assertEquals('Cool', $contact->properties->firstname->value); | ||
$this->assertEquals('Robot (Sample Contact)', $contact->properties->lastname->value); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,28 +1,28 @@ | ||
<?php | ||
|
||
namespace Tests; | ||
|
||
use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; | ||
use Orchestra\Testbench\TestCase as OrchTestCase; | ||
use Rossjcooper\LaravelHubSpot\HubSpotServiceProvider; | ||
|
||
abstract class TestCase extends OrchTestCase | ||
{ | ||
/** | ||
* Load our ServiceProvider | ||
*/ | ||
protected function getPackageProviders($app) | ||
{ | ||
return [HubSpotServiceProvider::class]; | ||
} | ||
|
||
/** | ||
* Loads in our package .env file | ||
*/ | ||
protected function getEnvironmentSetUp($app) | ||
{ | ||
$app->useEnvironmentPath(__DIR__ . '/..'); | ||
$app->bootstrapWith([LoadEnvironmentVariables::class]); | ||
parent::getEnvironmentSetUp($app); | ||
} | ||
} | ||
<?php | ||
|
||
namespace Tests; | ||
|
||
use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; | ||
use Orchestra\Testbench\TestCase as OrchTestCase; | ||
use Rossjcooper\LaravelHubSpot\HubSpotServiceProvider; | ||
|
||
abstract class TestCase extends OrchTestCase | ||
{ | ||
/** | ||
* Load our ServiceProvider. | ||
*/ | ||
protected function getPackageProviders($app) | ||
{ | ||
return [HubSpotServiceProvider::class]; | ||
} | ||
|
||
/** | ||
* Loads in our package .env file. | ||
*/ | ||
protected function getEnvironmentSetUp($app) | ||
{ | ||
$app->useEnvironmentPath(__DIR__.'/..'); | ||
$app->bootstrapWith([LoadEnvironmentVariables::class]); | ||
parent::getEnvironmentSetUp($app); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,24 +1,23 @@ | ||
<?php | ||
|
||
namespace Tests\Unit; | ||
|
||
use Tests\TestCase; | ||
use Rossjcooper\LaravelHubSpot\HubSpot; | ||
use SevenShores\Hubspot\Factory; | ||
|
||
class ServiceProviderTest extends TestCase | ||
{ | ||
public function test_service_provider_bindings() | ||
{ | ||
$hubspot = app(HubSpot::class); | ||
|
||
$this->assertInstanceOf(HubSpot::class, $hubspot); | ||
} | ||
|
||
public function test_api_key_set() | ||
{ | ||
$hubspot = app(HubSpot::class); | ||
|
||
$this->assertEquals(env('HUBSPOT_API_KEY'), $hubspot->client->key); | ||
} | ||
} | ||
<?php | ||
|
||
namespace Tests\Unit; | ||
|
||
use Tests\TestCase; | ||
use Rossjcooper\LaravelHubSpot\HubSpot; | ||
|
||
class ServiceProviderTest extends TestCase | ||
{ | ||
public function test_service_provider_bindings() | ||
{ | ||
$hubspot = app(HubSpot::class); | ||
|
||
$this->assertInstanceOf(HubSpot::class, $hubspot); | ||
} | ||
|
||
public function test_api_key_set() | ||
{ | ||
$hubspot = app(HubSpot::class); | ||
|
||
$this->assertEquals(env('HUBSPOT_API_KEY'), $hubspot->client->key); | ||
} | ||
} |