Beispiel #1
0
 public static function identities(Tacit $app)
 {
     if (!is_array(static::$identities)) {
         $identitiesFile = $app->config('tacit.identitiesFile');
         if (is_readable($identitiesFile)) {
             static::$identities = (include $identitiesFile);
         }
     }
     return static::$identities;
 }
Beispiel #2
0
 public function setUp()
 {
     $tacit = new Tacit(['app' => ['mode' => 'development', 'startTime' => microtime(true)], 'connection' => ['class' => 'Tacit\\Model\\Monga\\MongaRepository', 'server' => 'localhost', 'options' => array('connect' => false), 'repository' => 'tacit_test']]);
     $tacit->setName('test_monga');
     $this->fixture = $tacit->container->get('repository');
 }
Beispiel #3
0
 /**
  * Test Tacit::getInstance()
  */
 public function testGetInstance()
 {
     $tacit = Tacit::getInstance();
     $this->assertInstanceOf('Tacit\\Tacit', $tacit, 'Could not get a valid instance of \\Tacit\\Tacit');
     $this->assertInstanceOf('Slim\\Slim', $tacit, 'The instance of Tacit instantiated is not an instance of \\Slim\\Slim');
 }
Beispiel #4
0
 /**
  * Get a new instance of a Persistent object.
  *
  * @param Repository $repository A specific repository for the instance.
  *
  * @return Persistent
  */
 public function __construct(Repository $repository = null)
 {
     if (null === $repository) {
         $this->_repository = Tacit::getInstance()->container->get('repository');
     } else {
         $this->_repository = $repository;
     }
 }
Beispiel #5
0
 /**
  * Generate a URL for the current requested route.
  *
  * @param array $params An array of parameters to add to the route.
  *
  * @return string The current route's URL.
  */
 protected function self(array $params = array())
 {
     $request = $this->app->request();
     $url = $request->getUrl();
     $url .= $request->getRootUri();
     $url .= $request->getResourceUri();
     $getParams = $request->get();
     $getParams = array_merge($getParams, $params);
     if (!empty($getParams)) {
         $url .= '?';
         $qs = array();
         foreach ($getParams as $qKey => $qValue) {
             $qs[] = urlencode($qKey) . "=" . urlencode($qValue);
         }
         $url .= implode('&', $qs);
     }
     return $url;
 }
Beispiel #6
0
 /**
  * Test the static HMAC::identities() method.
  *
  * @param array $expected
  *
  * @dataProvider providerIdentities
  */
 public function testIdentities($expected)
 {
     $tacit = Tacit::getInstance();
     $tacit->config('tacit.identitiesFile', __DIR__ . '/../../../identities.php');
     $this->assertEquals($expected, (new HMAC())->identities($tacit));
 }