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; }
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'); }
/** * 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'); }
/** * 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; } }
/** * 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; }
/** * 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)); }