-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #675 from lucatume/v4-customizable-backup-setting
feat(WPLoader) add global state control support, fix #673
- Loading branch information
Showing
8 changed files
with
732 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
use lucatume\WPBrowser\TestCase\WPTestCase; | ||
|
||
class BackupControlTestCaseStore | ||
{ | ||
public static $staticAttribute = 'initial_value'; | ||
public static $staticAttributeTwo = 'initial_value'; | ||
public static $staticAttributeThree = 'initial_value'; | ||
public static $staticAttributeFour = 'initial_value'; | ||
} | ||
|
||
class BackupControlTestCaseStoreTwo | ||
{ | ||
public static $staticAttribute = 'initial_value'; | ||
public static $staticAttributeTwo = 'initial_value'; | ||
public static $staticAttributeThree = 'initial_value'; | ||
public static $staticAttributeFour = 'initial_value'; | ||
} | ||
|
||
class BackupControlTestCase extends WPTestCase | ||
{ | ||
/** | ||
* Override the method to avoid issues with Codeception specific meta data. | ||
*/ | ||
protected function _setUp() | ||
{ | ||
$this->_before(); | ||
} | ||
|
||
public function testBackupGlobalsIsFalse(): void | ||
{ | ||
$this->assertFalse($this->backupGlobals); | ||
} | ||
|
||
public function testBackupGlobalsIsTrue(): void | ||
{ | ||
$this->assertTrue($this->backupGlobals); | ||
} | ||
|
||
public function testWillUpdateTheValueOfGlobalVar(): void | ||
{ | ||
global $_wpbrowser_test_global_var; | ||
$_wpbrowser_test_global_var = 'updated_value'; | ||
$this->assertTrue(true); // Useless assertion to avoid the test to be marked as risky. | ||
} | ||
|
||
public function testWillAlterStoreStaticAttribute(): void | ||
{ | ||
BackupControlTestCaseStore::$staticAttribute = 'updated_value'; | ||
BackupControlTestCaseStore::$staticAttributeTwo = 'updated_value'; | ||
BackupControlTestCaseStore::$staticAttributeThree = 'updated_value'; | ||
BackupControlTestCaseStore::$staticAttributeFour = 'updated_value'; | ||
BackupControlTestCaseStoreTwo::$staticAttribute = 'updated_value'; | ||
BackupControlTestCaseStoreTwo::$staticAttributeTwo = 'updated_value'; | ||
BackupControlTestCaseStoreTwo::$staticAttributeThree = 'updated_value'; | ||
BackupControlTestCaseStoreTwo::$staticAttributeFour = 'updated_value'; | ||
$this->assertTrue(true); // Useless assertion to avoid the test to be marked as risky. | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
tests/_data/files/BackupControlTestCaseOverridingTestCase.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use lucatume\WPBrowser\TestCase\WPTestCase; | ||
|
||
class BackupControlTestCaseOverridingStore | ||
{ | ||
public static $staticAttribute = 'initial_value'; | ||
} | ||
|
||
class BackupControlTestCaseOverridingTestCase extends WPTestCase | ||
{ | ||
protected $backupGlobals = false; | ||
protected $backupStaticAttributes = false; | ||
|
||
/** | ||
* Override the method to avoid issues with Codeception specific meta data. | ||
*/ | ||
protected function _setUp() | ||
{ | ||
$this->_before(); | ||
} | ||
|
||
public function testBackupGlobalsIsFalse(): void | ||
{ | ||
$this->assertFalse($this->backupGlobals); | ||
} | ||
|
||
public function testWillAlterStoreStaticAttribute(): void | ||
{ | ||
BackupControlTestCaseOverridingStore::$staticAttribute = 'updated_value'; | ||
$this->assertTrue(true); // Useless assertion to avoid the test to be marked as risky. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.