Skip to content

Commit

Permalink
Merge pull request #12 from WordPress-Phoenix/full-qualify-namespace
Browse files Browse the repository at this point in the history
Use fully qualified namespace
  • Loading branch information
Mr-Ming authored May 2, 2019
2 parents 45ada5f + 06e9ba9 commit c5e8fba
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/boilerplates/simple/tests/admin/test-class-app.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ final class App_Test extends WP_UnitTestCase {
/**
* Test __construct
*
* @covers <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Admin\App::__construct
* @covers \<%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Admin\App::__construct
*/
public function test_construct() {
$installed_dir = '/var/installed/dir';
$installed_url = '/var/installed/url';
$version = 1.0;

$app = new <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Admin\App( $installed_dir, $installed_url, $version );
$app = new \<%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Admin\App( $installed_dir, $installed_url, $version );

$this->assertEquals( $installed_dir, $app->installed_dir );
$this->assertEquals( $installed_url, $app->installed_url );
Expand Down
17 changes: 9 additions & 8 deletions app/boilerplates/simple/tests/test-class-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ final class Plugin_Test extends WP_UnitTestCase {
/**
* Test onload
*
* @covers <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin::onload
* @covers \<%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin::onload
*/
public function test_onload() {
$instance = new stdClass();
$plugin = new <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin();

$plugin = new \<%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin();
$result = $plugin->onload( $instance );

$this->assertNull( $result );
Expand All @@ -26,12 +27,12 @@ public function test_onload() {
/**
* Test init
*
* @covers <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin::init
* @covers \<%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin::init
*/
public function test_init() {
global $wp_actions;

$plugin = new <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin();
$plugin = new \<%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin();
$result = $plugin->init();

$this->assertTrue( isset( $wp_actions['<%= US_SLUG %>_before_init'] ) );
Expand All @@ -43,10 +44,10 @@ public function test_init() {
/**
* Test authenticated_init when user is not logged in
*
* @covers <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin::authenticated_init
* @covers \<%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin::authenticated_init
*/
public function test_authenticated_init_when_user_is_not_logged_in() {
$plugin = new <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin();
$plugin = new \<%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin();
$authenticated_init = $plugin->authenticated_init();

$this->assertFalse( isset( $plugin->admin ) );
Expand All @@ -56,13 +57,13 @@ public function test_authenticated_init_when_user_is_not_logged_in() {
/**
* Test authenticated_init when user is logged in
*
* @covers <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin::authenticated_init
* @covers \<%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin::authenticated_init
*/
public function test_authenticated_init_when_user_is_logged_in() {
$user_id = $this->factory->user->create();
wp_set_current_user( $user_id );

$plugin = new <%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin();
$plugin = new \<%= PRIMARY_NAMESPACE %>\<%= SECONDARY_NAMESPACE %>\Plugin();
$authenticated_init = $plugin->authenticated_init();

$this->assertTrue( isset( $plugin->admin ) );
Expand Down
2 changes: 1 addition & 1 deletion wordpress-development-toolkit.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @author David Ryan - WordPress Phoenix
* @license GNU GPL v2.0+
* @link https://github.com/wordpress-phoenix
* @version 3.2.0
* @version 3.2.1
*
* Built using WP PHX Plugin Generator v1.1.0 on Tuesday 23rd of January 2018 07:33:12 AM
* @link https://github.com/WordPress-Phoenix/wordpress-development-toolkit
Expand Down

0 comments on commit c5e8fba

Please sign in to comment.