123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- class sfTesterUser extends sfTester
- {
- protected $user;
-
- public function prepare()
- {
- }
-
- public function initialize()
- {
- $this->user = $this->browser->getUser();
- }
-
- public function isAttribute($key, $value, $ns = null)
- {
- $this->tester->is($this->user->getAttribute($key, null, $ns), $value, sprintf('user attribute "%s" is "%s"', $key, $value));
- return $this->getObjectToReturn();
- }
-
- public function isFlash($key, $value)
- {
- $this->tester->is($this->user->getFlash($key), $value, sprintf('user flash "%s" is "%s"', $key, $value));
- return $this->getObjectToReturn();
- }
-
- public function isCulture($culture)
- {
- $this->tester->is($this->user->getCulture(), $culture, sprintf('user culture is "%s"', $culture));
- return $this->getObjectToReturn();
- }
-
- public function isAuthenticated($boolean = true)
- {
- $this->tester->is($this->user->isAuthenticated(), $boolean, sprintf('user is %sauthenticated', $boolean ? '' : 'not '));
- return $this->getObjectToReturn();
- }
-
- public function hasCredential($credentials, $boolean = true, $useAnd = true)
- {
- $this->tester->is($this->user->hasCredential($credentials, $useAnd), $boolean, sprintf('user has %s the right credentials', $boolean ? '' : 'not '));
- return $this->getObjectToReturn();
- }
- }
|