forked from bshaffer/oauth2-server-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Travis CI installer for Phalcon * Travis CI config for phalcon * Refactored to the corresponding directory for the Phalcon classes * Added phalcon autoload tests * Test test * Get client details test * Init DB for phalcon test * Refactored di connection * More tests * Disabled throwing an exception * Setup methods * Fixed table names * Finalize tests
- Loading branch information
1 parent
4d77748
commit f18eb47
Showing
15 changed files
with
130 additions
and
32 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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: lucas | ||
* Date: 7/1/2016 | ||
* Time: 2:08 PM | ||
*/ | ||
|
||
namespace OAuth2\Storage\Phalcon; | ||
|
||
|
||
use OAuth2\Storage\BaseTest; | ||
use Phalcon\Db\Adapter\Pdo\Mysql; | ||
use Phalcon\Di; | ||
use Phalcon\Di\FactoryDefault; | ||
use Phalcon\Escaper; | ||
use Phalcon\Mvc\Micro; | ||
use Phalcon\Mvc\Model\Manager; | ||
use Phalcon\Mvc\Model\MetaData\Memory; | ||
use Phalcon\Mvc\Url; | ||
|
||
class PhalconTest extends BaseTest | ||
{ | ||
private $di; | ||
/** | ||
* This method is called before a test is executed. | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->checkExtension('phalcon'); | ||
// Reset the DI container | ||
Di::reset(); | ||
// Instantiate a new DI container | ||
$di = new Di(); | ||
// Set the URL | ||
$di->set( | ||
'url', | ||
function () { | ||
$url = new Url(); | ||
$url->setBaseUri('/'); | ||
return $url; | ||
} | ||
); | ||
|
||
$di->set( | ||
'escaper', | ||
function () { | ||
return new Escaper(); | ||
} | ||
); | ||
|
||
$di->set('db', function() { | ||
return new Mysql(array( | ||
"host" => "localhost", | ||
"username" => "root", | ||
"password" => "", | ||
"dbname" => "oauth2_server_php", | ||
)); | ||
}); | ||
|
||
$di->set( | ||
'modelsManager', | ||
function () { | ||
return new Manager(); | ||
} | ||
); | ||
|
||
$di->set( | ||
'modelsMetadata', | ||
function () { | ||
return new Memory(); | ||
} | ||
); | ||
|
||
$this->di = $di; | ||
} | ||
|
||
public function checkExtension($extension) | ||
{ | ||
$message = function ($ext) { | ||
sprintf('Warning: %s extension is not loaded', $ext); | ||
}; | ||
if (is_array($extension)) { | ||
foreach ($extension as $ext) { | ||
if (!extension_loaded($ext)) { | ||
$this->markTestSkipped($message($ext)); | ||
break; | ||
} | ||
} | ||
} elseif (!extension_loaded($extension)) { | ||
$this->markTestSkipped($message($extension)); | ||
} | ||
} | ||
|
||
public function testPhalconDataStorage(){ | ||
$this->setUp(); | ||
$storage = new Phalcon($this->di); | ||
$this->assertNotNull($storage->getClientDetails('oauth_test_client')); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.