示例#1
0
 public function testIsConsoleFalse()
 {
     $stub = $this->getMockBuilder('DetectEnviroment')->setMethods(array('isCli', 'isSlack', 'isHttp'))->getMock();
     $stub->method('isCli')->willReturn(false);
     $stub->method('isSlack')->willReturn(true);
     $stub->method('isHttp')->willReturn(true);
     $testo = new Slashas\Slashas($stub);
     $this->assertFalse($testo->isConsole());
 }
示例#2
0
 /**
  * Test if we are running slack via unsetted $_POST var
  */
 public function testSetEnvIsConsoleFalse()
 {
     unset($_POST['token']);
     $testo = new Slashas\Slashas(new Slashas\DetectEnviroment());
     $this->assertFalse($testo->isSlack());
 }
示例#3
0
文件: test.php 项目: bolstad/slashas
<?php

require __DIR__ . "/../vendor/autoload.php";
use Slashas\Slashas;
$defaults = array('token' => time(), 'team_id' => 'fooo_team_id', 'team_domain' => 'fooo_team_domain', 'channel_id' => 'foo_channel_id', 'channel_name' => 'foo_channel_name', 'timestamp' => time() . '.000005', 'user_id' => 'foo_user_id', 'user_name' => 'foo_user_name', 'text' => 'foo_text', 'trigger_word' => 'foo');
$funk = new Slashas\Slashas(new Slashas\DetectEnviroment());
$funk->setDefaults($defaults);
$env = $funk->getEnv();
echo "we are in '{$env}'\n";
echo "token:" . $funk->getVariable('token') . "\n";
示例#4
0
 /**
  * Test if we are running slack via unsetted $_GET var
  */
 public function testSetEnvIsHTTPFalse()
 {
     unset($_SERVER['SERVER_NAME']);
     $testo = new Slashas\Slashas(new Slashas\DetectEnviroment());
     $this->assertFalse($testo->isHttp());
 }