Skip to content

Commit 489fade

Browse files
Patching the package
Fixing the facade
1 parent 65de537 commit 489fade

File tree

10 files changed

+63
-66
lines changed

10 files changed

+63
-66
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
.gitignore export-ignore
99
.scrutinizer.yml export-ignore
1010
.travis.yml export-ignore
11-
phpunit.xml export-ignore
11+
phpunit.xml.dist export-ignore
1212
CONTRIBUTING.md export-ignore

.travis.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,23 @@ sudo: false
55
php:
66
- 7.0
77
- 7.1
8+
- 7.2
89
- nightly
910

1011
matrix:
1112
allow_failures:
13+
- php: 7.2
1214
- php: nightly
1315

14-
env:
15-
- TESTBENCH_VERSION=3.5.*
16-
1716
before_script:
1817
- travis_retry composer self-update
19-
- travis_retry composer require --prefer-source --no-interaction --dev "orchestra/testbench:${TESTBENCH_VERSION}"
18+
- travis_retry composer install --prefer-source --no-interaction
2019

2120
script:
2221
- composer validate
2322
- mkdir -p build/logs
2423
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
2524

2625
after_script:
27-
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
28-
- if [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi
26+
- if [ "$TRAVIS_PHP_VERSION" != "7.2" ] && [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
27+
- if [ "$TRAVIS_PHP_VERSION" != "7.2" ] && [ "$TRAVIS_PHP_VERSION" != "nightly" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi

composer.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
"arcanedev/support": "~4.0"
2121
},
2222
"require-dev": {
23-
"phpunit/phpunit": "~6.0",
24-
"phpunit/phpcov": "~4.0"
23+
"phpunit/phpunit": "~6.0",
24+
"phpunit/phpcov": "~4.0",
25+
"orchestra/testbench": "~3.5.0"
2526
},
2627
"autoload": {
2728
"psr-4": {
@@ -43,8 +44,5 @@
4344
"Gravatar": "Arcanedev\\Gravatar\\Facades\\Gravatar"
4445
}
4546
}
46-
},
47-
"scripts": {
48-
"testbench": "composer require --dev \"orchestra/testbench=~3.0\""
4947
}
5048
}
File renamed without changes.

src/Facades/Gravatar.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php namespace Arcanedev\Gravatar\Facades;
22

3+
use Arcanedev\Gravatar\Contracts\Gravatar as GravatarContract;
34
use Illuminate\Support\Facades\Facade;
45

56
/**
@@ -15,5 +16,5 @@ class Gravatar extends Facade
1516
*
1617
* @return string
1718
*/
18-
protected static function getFacadeAccessor() { return 'arcanedev.gravatar'; }
19+
protected static function getFacadeAccessor() { return GravatarContract::class; }
1920
}

src/GravatarServiceProvider.php

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,17 @@ public function register()
4242
parent::register();
4343

4444
$this->registerConfig();
45-
$this->registerGravatar();
45+
46+
$this->singleton(Contracts\Gravatar::class, function($app) {
47+
/** @var \Illuminate\Contracts\Config\Repository $config */
48+
$config = $app['config'];
49+
50+
return new Gravatar(
51+
$config->get('gravatar.default', 'mm'),
52+
$config->get('gravatar.size', 80),
53+
$config->get('gravatar.max-rating', 'g')
54+
);
55+
});
4656
}
4757

4858
/**
@@ -66,26 +76,4 @@ public function provides()
6676
Contracts\Gravatar::class,
6777
];
6878
}
69-
70-
/* -----------------------------------------------------------------
71-
| Other Methods
72-
| -----------------------------------------------------------------
73-
*/
74-
75-
/**
76-
* Register Gravatar Helper.
77-
*/
78-
private function registerGravatar()
79-
{
80-
$this->singleton(Contracts\Gravatar::class, function($app) {
81-
/** @var \Illuminate\Contracts\Config\Repository $config */
82-
$config = $app['config'];
83-
84-
return new Gravatar(
85-
$config->get('gravatar.default', 'mm'),
86-
$config->get('gravatar.size', 80),
87-
$config->get('gravatar.max-rating', 'g')
88-
);
89-
});
90-
}
9179
}

tests/GravatarServiceProviderTest.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@
1010
*/
1111
class GravatarServiceProviderTest extends TestCase
1212
{
13-
/* ------------------------------------------------------------------------------------------------
13+
/* -----------------------------------------------------------------
1414
| Properties
15-
| ------------------------------------------------------------------------------------------------
15+
| -----------------------------------------------------------------
1616
*/
17+
1718
/** @var GravatarServiceProvider */
1819
private $provider;
1920

20-
/* ------------------------------------------------------------------------------------------------
21-
| Main Functions
22-
| ------------------------------------------------------------------------------------------------
21+
/* -----------------------------------------------------------------
22+
| Main Methods
23+
| -----------------------------------------------------------------
2324
*/
25+
2426
public function setUp()
2527
{
2628
parent::setUp();
@@ -35,10 +37,11 @@ public function tearDown()
3537
parent::tearDown();
3638
}
3739

38-
/* ------------------------------------------------------------------------------------------------
39-
| Test Functions
40-
| ------------------------------------------------------------------------------------------------
40+
/* -----------------------------------------------------------------
41+
| Tests
42+
| -----------------------------------------------------------------
4143
*/
44+
4245
/** @test */
4346
public function it_can_be_instantiated()
4447
{

tests/GravatarTest.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@
1010
*/
1111
class GravatarTest extends TestCase
1212
{
13-
/* ------------------------------------------------------------------------------------------------
13+
/* -----------------------------------------------------------------
1414
| Properties
15-
| ------------------------------------------------------------------------------------------------
15+
| -----------------------------------------------------------------
1616
*/
17+
1718
/** @var \Arcanedev\Gravatar\Gravatar */
1819
private $gravatar;
1920

20-
/* ------------------------------------------------------------------------------------------------
21-
| Main Functions
22-
| ------------------------------------------------------------------------------------------------
21+
/* -----------------------------------------------------------------
22+
| Main Methods
23+
| -----------------------------------------------------------------
2324
*/
25+
2426
public function setUp()
2527
{
2628
parent::setUp();
@@ -35,10 +37,11 @@ public function tearDown()
3537
parent::tearDown();
3638
}
3739

38-
/* ------------------------------------------------------------------------------------------------
39-
| Test Functions
40-
| ------------------------------------------------------------------------------------------------
40+
/* -----------------------------------------------------------------
41+
| Tests
42+
| -----------------------------------------------------------------
4143
*/
44+
4245
/** @test */
4346
public function it_can_be_instantiated()
4447
{
@@ -278,10 +281,11 @@ public function it_can_set_size_from_height_or_width_attributes()
278281
$this->assertSame(256, $this->gravatar->getSize());
279282
}
280283

281-
/* ------------------------------------------------------------------------------------------------
282-
| Other Functions
283-
| ------------------------------------------------------------------------------------------------
284+
/* -----------------------------------------------------------------
285+
| Other Methods
286+
| -----------------------------------------------------------------
284287
*/
288+
285289
/**
286290
* Assert the gravatar instance.
287291
*

tests/Helpers/HtmlBuilderTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
*/
1212
class HtmlBuilderTest extends TestCase
1313
{
14-
/* ------------------------------------------------------------------------------------------------
15-
| Test Functions
16-
| ------------------------------------------------------------------------------------------------
14+
/* -----------------------------------------------------------------
15+
| Tests
16+
| -----------------------------------------------------------------
1717
*/
18+
1819
/** @test */
1920
public function it_can_build_image_tag()
2021
{

tests/TestCase.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,35 @@
1010
*/
1111
abstract class TestCase extends BaseTestCase
1212
{
13-
/* ------------------------------------------------------------------------------------------------
13+
/* -----------------------------------------------------------------
1414
| Properties
15-
| ------------------------------------------------------------------------------------------------
15+
| -----------------------------------------------------------------
1616
*/
17+
1718
/**
1819
* ARCANEDEV email.
1920
*
2021
* @var string
2122
*/
2223
protected $email = 'arcanedev.maroc@gmail.com';
2324

24-
/* ------------------------------------------------------------------------------------------------
25-
| Main Functions
26-
| ------------------------------------------------------------------------------------------------
25+
/* -----------------------------------------------------------------
26+
| Main Methods
27+
| -----------------------------------------------------------------
2728
*/
29+
2830
public function setUp()
2931
{
3032
parent::setUp();
3133

3234
$this->app->loadDeferredProviders();
3335
}
3436

35-
/* ------------------------------------------------------------------------------------------------
36-
| Package Functions
37-
| ------------------------------------------------------------------------------------------------
37+
/* -----------------------------------------------------------------
38+
| Package Methods
39+
| -----------------------------------------------------------------
3840
*/
41+
3942
/**
4043
* Get package providers.
4144
*

0 commit comments

Comments
 (0)