-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial refactor unit test file #1055
base: development
Are you sure you want to change the base?
Changes from 1 commit
19646a0
7a78901
83febe7
95597ea
fbf0dc3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,11 @@ | ||
<?php | ||
|
||
namespace GFPDF\Tests; | ||
namespace GFPDF\Tests\Controller; | ||
|
||
use GFPDF\Controller\Controller_Actions; | ||
use GFPDF\Model\Model_Actions; | ||
use GFPDF\View\View_Actions; | ||
|
||
use WP_UnitTestCase; | ||
|
||
use Exception; | ||
|
||
/** | ||
* Test Gravity PDF Actions functionality | ||
|
@@ -26,7 +23,7 @@ | |
* | ||
* @group actions | ||
*/ | ||
class Test_Actions extends WP_UnitTestCase { | ||
class ActionTest extends \WP_UnitTestCase { | ||
/** | ||
* Our Controller | ||
* | ||
|
@@ -78,9 +75,10 @@ public function setUp() { | |
* | ||
* @since 4.0 | ||
*/ | ||
public function test_actions() { | ||
public function test_add_actions() { | ||
$this->assertSame( 10, has_action( 'admin_init', [ $this->controller, 'route' ] ) ); | ||
$this->assertSame( 20, has_action( 'admin_init', [ $this->controller, 'route_notices' ] ) ); | ||
|
||
} | ||
|
||
/** | ||
|
@@ -247,7 +245,7 @@ function( $routes ) { | |
/* Fail capability check */ | ||
try { | ||
$this->controller->route(); | ||
} catch ( Exception $e ) { | ||
} catch ( \Exception $e ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should look at utilising PHPUnit's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted @jakejackson1 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Applied and use WPDieException |
||
/* Expected */ | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, we should use the same namespace as the class being tested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed on recent push.