Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class IdentityTest extends Nette\Object
- {
- private $identityDir;
- private $user;
- public function __construct($tempDir, Nette\Http\User $user)
- {
- $this->user = $user;
- $this->identityDir = $tempDir . '/saveIdentity';
- if (false === file_exists($tempDir)) {
- mkdir($tempDir);
- }
- }
- public function startTest()
- {
- do {
- $file = $this->identityDir . '/' . Nette\Utils\Strings::random();
- } while (file_exists($file));
- file_put_contents($file, $this->user->getId());
- return array("test" => "test", "token" => basename($name)));
- }
- }
- /// config.neon
- services:
- identityTest: IdentityTest(%tempDir%)
- // FrontModule/BasePresenter
- public function injectIdenityTest(IdentityTest $it)
- {
- $this->identityTest = $it;
- }
- public function handleStartTesting()
- {
- $this->redirect(":CustomerAdmin:Sign:getIdentity", $this->identityTest->startTest());
- }
- // CustomerAdmin/SignPresenter
- // tohle se mi už přepisovat nechce
Advertisement
Add Comment
Please, Sign In to add comment