File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class Changelog
13
13
*
14
14
* @return string
15
15
*/
16
- private function getFile (): string
16
+ public function path (): string
17
17
{
18
18
return config ('changelog.file ' , base_path ('CHANGELOG.md ' ));
19
19
}
@@ -26,7 +26,7 @@ private function getFile(): string
26
26
*/
27
27
public function raw (): string
28
28
{
29
- $ file = $ this ->getFile ();
29
+ $ file = $ this ->path ();
30
30
31
31
if (!file_exists ($ file )) {
32
32
throw new ChangelogNotFoundException ();
Original file line number Diff line number Diff line change 2
2
3
3
namespace BlameButton \Laravel \Changelog \Tests ;
4
4
5
+ use BlameButton \Laravel \Changelog \Changelog ;
5
6
use BlameButton \Laravel \Changelog \ChangelogFacade ;
6
7
use BlameButton \Laravel \Changelog \ChangelogServiceProvider ;
7
8
use Illuminate \Support \Facades \Storage ;
9
+ use Mockery \MockInterface ;
8
10
use Orchestra \Testbench \TestCase ;
9
11
10
12
class ChangelogTest extends TestCase
@@ -29,7 +31,13 @@ public function testRaw(): void
29
31
30
32
Storage::put (base_path ('CHANGELOG.md ' ), $ expected );
31
33
32
- $ content = ChangelogFacade::raw ();
34
+ /** @var Changelog $changelog */
35
+ $ changelog = $ this ->mock (Changelog::class, function (MockInterface $ mock ) {
36
+ $ mock ->shouldReceive ('path ' )->andReturn (Storage::path (base_path ('CHANGELOG.md ' )));
37
+ $ mock ->shouldReceive ('raw ' )->passthru ();
38
+ });
39
+
40
+ $ content = $ changelog ->raw ();
33
41
34
42
self ::assertNotNull ($ content );
35
43
self ::assertEquals ($ expected , $ content );
You can’t perform that action at this time.
0 commit comments