コード例 #1
0
ファイル: SMSAPITestTest.php プロジェクト: pontifex/sms
 /**
  *
  */
 public function testPrepareUrlShouldReturnSpecificString()
 {
     $config = array('smsapi' => array('url' => 'URL', 'username' => 'USERNAME', 'password' => 'PASSWORD'));
     $this->getServiceManager()->setService('Config', $config);
     $obj = new Adapter\SMSAPITest($this->getServiceManager());
     $prepareUrl = Bootstrap::getMethod('SMS\\Model\\Adapter\\SMSAPITest', 'prepareUrl');
     $this->assertEquals('URL?username=USERNAME&password=PASSWORD&to=0049456456456&message=Message+content%21&test=1', $prepareUrl->invokeArgs($obj, array($this->makeItem())));
 }
コード例 #2
0
ファイル: SMSAPITest.php プロジェクト: pontifex/sms
 /**
  *
  */
 public function testSendRequest()
 {
     $SMSAPIMock = $this->getMockBuilder('\\SMS\\Model\\Adapter\\SMSAPI')->disableOriginalConstructor()->setMethods(array('makeClient'))->getMock();
     $SMSAPIMock->expects($this->any())->method('makeClient')->will($this->returnValue($this->makeHttpClientMock()));
     /** @var Adapter\SMSAPI $SMSAPIMock */
     $SMSAPIMock->setServiceLocator($this->getServiceManager());
     $SMSAPIMock->setEventManager($this->makeEventManagerMock());
     $sendRequest = Bootstrap::getMethod('SMS\\Model\\Adapter\\SMSAPI', 'sendRequest');
     $actual = $sendRequest->invokeArgs($SMSAPIMock, array($this->makeItem()));
     $this->assertEquals('', $actual);
 }
コード例 #3
0
ファイル: SMSTest.php プロジェクト: pontifex/sms
 /**
  *
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
 }
コード例 #4
0
ファイル: AbstractAdapter.php プロジェクト: pontifex/sms
 /**
  *
  */
 public function setUp()
 {
     $this->serviceManager = Bootstrap::getServiceManager();
     $this->getServiceManager()->setService('eventManager', $this->makeEventManagerMock());
 }
コード例 #5
0
ファイル: Bootstrap.php プロジェクト: pontifex/sms
        if (is_readable($vendorPath . '/autoload.php')) {
            $loader = (include $vendorPath . '/autoload.php');
        } else {
            $zf2Path = getenv('ZF2_PATH') ?: (defined('ZF2_PATH') ? ZF2_PATH : (is_dir($vendorPath . '/ZF2/library') ? $vendorPath . '/ZF2/library' : false));
            if (!$zf2Path) {
                throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
            }
            include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
        }
        AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
    }
    /**
     * @param $path
     * @return bool|string
     */
    protected static function findParentPath($path)
    {
        $dir = __DIR__;
        $previousDir = '.';
        while (!is_dir($dir . '/' . $path)) {
            $dir = dirname($dir);
            if ($previousDir === $dir) {
                return false;
            }
            $previousDir = $dir;
        }
        return $dir . '/' . $path;
    }
}
Bootstrap::init();