-
Notifications
You must be signed in to change notification settings - Fork 30
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
Showing
3 changed files
with
55 additions
and
2 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
51 changes: 51 additions & 0 deletions
51
test/unit/php/includes/core/classes/commands/class-test-cli-event.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,51 @@ | ||
<?php | ||
/** | ||
* Class handles unit tests for GatherPress\Core\Commands\Cli_Event. | ||
* | ||
* @package GatherPress | ||
* @subpackage Core | ||
* @since 1.0.0 | ||
*/ | ||
|
||
namespace GatherPress\Tests\Core\Commands; | ||
|
||
use GatherPress\Core\Commands\Cli_Event; | ||
use GatherPress\Core\Event; | ||
use PMC\Unit_Test\Base; | ||
use PMC\Unit_Test\Utility; | ||
|
||
/** | ||
* Class Test_Block. | ||
* | ||
* @coversDefaultClass \GatherPress\Core\Commands\Cli_Event | ||
*/ | ||
class Test_Cli_Event extends Base { | ||
/** | ||
* Coverage for rsvp. | ||
* | ||
* @covers ::rsvp | ||
* | ||
* @return void | ||
*/ | ||
public function test_rsvp(): void { | ||
$cli_event = new Cli_Event(); | ||
$event = $this->mock->post( array( 'post_type' => Event::POST_TYPE ) )->get(); | ||
$user = $this->mock->user()->get(); | ||
$status = 'not_attending'; | ||
$assoc_args = array( | ||
'event_id' => $event->ID, | ||
'user_id' => $user->ID, | ||
'status' => $status, | ||
); | ||
|
||
$output = Utility::buffer_and_return( array( $cli_event, 'rsvp' ), array( array(), $assoc_args ) ); | ||
$expects = sprintf( | ||
'Success: The RSVP status for Event ID "%1$d" has been successfully set to "%2$s" for User ID "%3$d".', | ||
$event->ID, | ||
$status, | ||
$user->ID, | ||
); | ||
|
||
$this->assertSame( $expects, $output, 'Failed to assert output matches.' ); | ||
} | ||
} |