Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Cleanup for version control PR #151

Merged
merged 2 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion wp-modules/app/js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export type InitialPatternManager = {
patternCategories: QueriedCategories;
patterns: Patterns;
siteUrl: string;
themeName: string;
showVersionControlNotice: boolean;
};

Expand Down
22 changes: 5 additions & 17 deletions wp-modules/get-version-control/tests/GetVersionControlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public function setUp() {
* @inheritDoc
*/
public function tearDown() {
remove_filter( 'template_directory', [ $this, 'get_template_directory' ] );

delete_user_meta( $this->user_id, get_version_control_meta_key() );
wp_delete_user( $this->user_id );

remove_filter( 'template_directory', [ $this, 'get_template_directory' ] );

parent::tearDown();
}

Expand Down Expand Up @@ -76,24 +76,15 @@ public function test_test_theme_contains_version_control_folder() {
* Tests `get_dismissed_themes()` from the `get-version-control` module.
*/
public function test_get_dismissed_themes() {
$this->assertSame(
$this->get_mock_dismissed_themes(),
get_dismissed_themes(),
);
$this->assertSame( $this->get_mock_dismissed_themes(), get_dismissed_themes() );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always forget that phpcs doesn't do formatting like prettier. Strange, huh?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, very strange!

}

/**
* Tests `check_version_control_notice_should_show()` from the `get-version-control` module.
*/
public function test_check_version_control_notice_should_show() {
$this->assertFalse(
(bool) check_version_control_notice_should_show( $this->get_mock_dismissed_themes()[0] )
);

$this->assertTrue(
(bool) check_version_control_notice_should_show( $this->get_mock_non_dismissed_theme() )
);

$this->assertFalse( (bool) check_version_control_notice_should_show( $this->get_mock_dismissed_themes()[0] ) );
$this->assertTrue( (bool) check_version_control_notice_should_show( $this->get_mock_non_dismissed_theme() ) );
// Theme name not found in user meta, but user has a version control folder in the path.
$this->assertFalse(
(bool) check_version_control_notice_should_show( $this->get_mock_non_dismissed_theme(), $this->get_mock_version_control_folder() )
Expand All @@ -105,7 +96,6 @@ public function test_check_version_control_notice_should_show() {
*/
public function test_check_for_version_control_in_theme() {
$this->assertTrue( (bool) check_for_version_control_in_theme( $this->get_mock_version_control_folder() ) );

// Git not used in fixture.
$this->assertFalse( (bool) check_for_version_control_in_theme( '/.git' ) );
}
Expand All @@ -115,8 +105,6 @@ public function test_check_for_version_control_in_theme() {
*/
public function test_check_theme_name_dismissed() {
$this->assertTrue( (bool) check_theme_name_dismissed( $this->get_mock_dismissed_themes()[0] ) );

// Git not used in fixture.
$this->assertFalse( (bool) check_theme_name_dismissed( $this->get_mock_non_dismissed_theme() ) );
}
}