Skip to content

Commit

Permalink
Merge pull request #1260 from hydephp/remove-deprecated-code
Browse files Browse the repository at this point in the history
Remove deprecated `SourceFile::withoutDirectoryPrefix ` method only used in one test
  • Loading branch information
caendesilva authored Mar 12, 2023
2 parents 85961bc + 726b555 commit 721b09e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 19 deletions.
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ This serves two purposes:
- Removed `RenderData:.getCurrentPage` method deprecated in v1.0.0-RC.2
- Removed `RenderData:.getCurrentRoute` method deprecated in v1.0.0-RC.2
- Removed deprecated `HydePage::$canonicalUrl` property (replaced with `HydePage::getCanonicalUrl()`).
- Removed deprecated `SourceFile::withoutDirectoryPrefix` method only used in one test.

### Fixed
- Fixed the blog post article view where metadata assembly used legacy hard-coded paths instead of dynamic path information.
Expand Down
8 changes: 0 additions & 8 deletions packages/framework/src/Support/Filesystem/SourceFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Hyde\Support\Filesystem;

use Hyde\Pages\Concerns\HydePage;
use Illuminate\Support\Str;

/**
* File abstraction for a project source file.
Expand Down Expand Up @@ -40,11 +39,4 @@ public function toArray(): array
'pageClass' => $this->pageClass,
]);
}

/** @deprecated This method is not used anywhere other than tests and may be removed */
public function withoutDirectoryPrefix(): string
{
// Works like basename, but keeps subdirectory names.
return Str::after($this->path, $this->pageClass::sourceDirectory().'/');
}
}
11 changes: 0 additions & 11 deletions packages/framework/tests/Feature/Support/SourceFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,4 @@ public function test_to_array_with_file_in_subdirectory()
Filesystem::unlink('foo/bar.txt');
rmdir(Hyde::path('foo'));
}

public function test_without_directory_prefix_retains_subdirectories()
{
$this->assertSame('foo/bar/baz.txt',
SourceFile::make('foo/bar/baz.txt', MarkdownPage::class)->withoutDirectoryPrefix()
);

$this->assertSame('foo/bar.txt',
SourceFile::make('_pages/foo/bar.txt', MarkdownPage::class)->withoutDirectoryPrefix()
);
}
}

0 comments on commit 721b09e

Please sign in to comment.