-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2dad24
commit 6251d11
Showing
2 changed files
with
64 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
namespace ElementorEditorTesting\Traits; | ||
|
||
use Elementor\Plugin; | ||
use Elementor\Core\Kits\Manager; | ||
|
||
/** | ||
* @mixin \WP_UnitTestCase | ||
*/ | ||
trait Kit_Trait { | ||
protected function create_default_kit() { | ||
return Manager::create_default_kit(); | ||
} | ||
|
||
protected function remove_default_kit() { | ||
// Make sure the the 'wp_delete_post' function will actually delete the kit. | ||
$_GET['force_delete_kit'] = '1'; | ||
|
||
$active_kit_id = Plugin::$instance->kits_manager->get_active_id(); | ||
|
||
wp_delete_post( $active_kit_id, true ); | ||
delete_option( Manager::OPTION_ACTIVE ); | ||
|
||
unset( $_GET['force_delete_kit'] ); | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
namespace ElementorEditorTesting\Traits; | ||
|
||
use Elementor\Data\Manager; | ||
use ElementorEditorTesting\Elementor_Test_Base; | ||
|
||
/** | ||
* @mixin Elementor_Test_Base | ||
*/ | ||
Trait Rest_Trait { | ||
/** | ||
* @var Manager | ||
*/ | ||
protected $data_manager; | ||
|
||
public function setUp() { | ||
parent::setUp(); | ||
|
||
$this->data_manager = Manager::instance(); | ||
$this->data_manager->kill_server(); | ||
} | ||
|
||
protected function http_get( $command, $args = [] ) { | ||
return $this->data_manager->run( $command, $args, 'GET' ); | ||
} | ||
|
||
protected function http_post( $command, $args = [] ) { | ||
return $this->data_manager->run( $command, $args, 'POST' ); | ||
} | ||
|
||
protected function http_put( $command, $args = [] ) { | ||
return $this->data_manager->run( $command, $args, 'PUT' ); | ||
} | ||
|
||
protected function http_delete( $command, $args = [] ) { | ||
return $this->data_manager->run( $command, $args, 'DELETE' ); | ||
} | ||
} |