Skip to content

Commit

Permalink
Fixed exclude path in CS fixer config
Browse files Browse the repository at this point in the history
  • Loading branch information
rossjcooper committed Sep 29, 2019
1 parent 9c76a95 commit b96013f
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 132 deletions.
2 changes: 1 addition & 1 deletion .php_cs.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('src')
->exclude('vendor')
->in(__DIR__)
;

Expand Down
33 changes: 18 additions & 15 deletions src/Facades/HubSpot.php
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';
}
}
20 changes: 9 additions & 11 deletions src/HubSpot.php
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
{
}
74 changes: 34 additions & 40 deletions src/HubSpotServiceProvider.php
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');
}
}
20 changes: 9 additions & 11 deletions src/config/hubspot.php
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,
],
];
46 changes: 23 additions & 23 deletions tests/API/ContactsTest.php
Original file line number Diff line number Diff line change
@@ -1,23 +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);
}
}
56 changes: 28 additions & 28 deletions tests/TestCase.php
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);
}
}
5 changes: 2 additions & 3 deletions tests/Unit/ServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Tests\TestCase;
use Rossjcooper\LaravelHubSpot\HubSpot;
use SevenShores\Hubspot\Factory;

class ServiceProviderTest extends TestCase
{
Expand All @@ -14,11 +13,11 @@ public function test_service_provider_bindings()

$this->assertInstanceOf(HubSpot::class, $hubspot);
}

public function test_api_key_set()
{
$hubspot = app(HubSpot::class);

$this->assertEquals(env('HUBSPOT_API_KEY'), $hubspot->client->key);
}
}

0 comments on commit b96013f

Please sign in to comment.