-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add an extra database seed in order to test SlackUser factorying
add test case for log clear command
- Loading branch information
elfaus
committed
Aug 13, 2016
1 parent
d73163c
commit bfe7226
Showing
4 changed files
with
82 additions
and
3 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,67 @@ | ||
<?php | ||
|
||
/** | ||
* User: Warlof Tutsimo <loic.leuilliot@gmail.com> | ||
* Date: 09/08/2016 | ||
* Time: 16:25 | ||
*/ | ||
|
||
namespace Seat\Slackbot\Tests; | ||
|
||
use Orchestra\Testbench\TestCase; | ||
use Seat\Services\Settings\Seat; | ||
use Seat\Slackbot\Commands\SlackChannelsUpdate; | ||
use Seat\Slackbot\Commands\SlackLogsClear; | ||
use Seat\Slackbot\Helpers\SlackApi; | ||
use Seat\Slackbot\Models\SlackChannel; | ||
use Seat\Slackbot\Models\SlackLog; | ||
|
||
class SlackLogsClearTest extends TestCase | ||
{ | ||
/** | ||
* @var SlackApi | ||
*/ | ||
private $slackApi; | ||
|
||
public function getEnvironmentSetUp($app) | ||
{ | ||
$app['config']->set('database.default', 'mysql'); | ||
$app['config']->set('database.connections.mysql', [ | ||
'driver' => 'mysql', | ||
'host' => getenv('database_host'), | ||
'database' => getenv('database_name'), | ||
'username' => getenv('database_user'), | ||
'password' => getenv('database_pass'), | ||
'charset' => 'utf8', | ||
'collation' => 'utf8_unicode_ci', | ||
'prefix' => '' | ||
]); | ||
} | ||
|
||
public function testChannelUpdate() | ||
{ | ||
$logAmount = SlackLog::all()->count(); | ||
$this->assertGreaterThan(0, $logAmount); | ||
|
||
$command = new SlackLogsClear(); | ||
$command->handle(); | ||
|
||
$logAmount = SlackLog::all()->count(); | ||
|
||
// compare both array | ||
$this->assertEquals(0, $logAmount); | ||
} | ||
|
||
/** | ||
* @expectedException Seat\Slackbot\Exceptions\SlackSettingException | ||
*/ | ||
public function testTokenException() | ||
{ | ||
// pre test | ||
Seat::set('slack_token', ''); | ||
|
||
// test | ||
$job = new SlackChannelsUpdate(); | ||
$job->handle(); | ||
} | ||
} |
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