Remove some circular references

This commit is contained in:
Romain Neutron
2014-02-20 19:14:35 +01:00
parent 9e650a7954
commit 862fe696cb
18 changed files with 52 additions and 47 deletions

View File

@@ -8,25 +8,25 @@ class NewEmailTest extends \PhraseanetTestCase
{
public function testAnUnknownAddressIsNotAlreadyRegistered()
{
$constraint = new NewEmail(self::$DI['app']);
$constraint = NewEmail::create(self::$DI['app']);
$this->assertFalse($constraint->isAlreadyRegistered('nonehere'));
}
public function testARegisteredAddressIsAlreadyRegistered()
{
$constraint = new NewEmail(self::$DI['app']);
$constraint = NewEmail::create(self::$DI['app']);
$this->assertTrue($constraint->isAlreadyRegistered(self::$DI['user']->getEmail()));
}
public function testNullIsNotAlreadyRegistered()
{
$constraint = new NewEmail(self::$DI['app']);
$constraint = NewEmail::create(self::$DI['app']);
$this->assertFalse($constraint->isAlreadyRegistered(null));
}
public function testBlankIsNotAlreadyRegistered()
{
$constraint = new NewEmail(self::$DI['app']);
$constraint = NewEmail::create(self::$DI['app']);
$this->assertFalse($constraint->isAlreadyRegistered(''));
}
}

View File

@@ -8,25 +8,25 @@ class NewLoginTest extends \PhraseanetTestCase
{
public function testAnUnknownLoginIsNotAlreadyRegistered()
{
$constraint = new NewLogin(self::$DI['app']);
$constraint = NewLogin::create(self::$DI['app']);
$this->assertFalse($constraint->isAlreadyRegistered('nonehere@test.com'));
}
public function testARegisteredLoginIsAlreadyRegistered()
{
$constraint = new NewLogin(self::$DI['app']);
$constraint = NewLogin::create(self::$DI['app']);
$this->assertTrue($constraint->isAlreadyRegistered(self::$DI['user']->getLogin()));
}
public function testNullIsNotAlreadyRegistered()
{
$constraint = new NewLogin(self::$DI['app']);
$constraint = NewLogin::create(self::$DI['app']);
$this->assertFalse($constraint->isAlreadyRegistered(null));
}
public function testBlankIsNotAlreadyRegistered()
{
$constraint = new NewLogin(self::$DI['app']);
$constraint = NewLogin::create(self::$DI['app']);
$this->assertFalse($constraint->isAlreadyRegistered(''));
}
}

View File

@@ -23,7 +23,7 @@ class PasswordTokenTest extends \PhraseanetTestCase
->with($token)
->will($this->throwException(new NotFoundHttpException('Token not found')));
$constraint = new PasswordToken(self::$DI['app'], $random);
$constraint = new PasswordToken($random);
$this->assertFalse($constraint->isValid($token));
}
@@ -43,7 +43,7 @@ class PasswordTokenTest extends \PhraseanetTestCase
->with($token)
->will($this->returnValue(['usr_id' => mt_rand(), 'type' => \random::TYPE_PASSWORD]));
$constraint = new PasswordToken(self::$DI['app'], $random);
$constraint = new PasswordToken($random);
$this->assertTrue($constraint->isValid($token));
}
}

View File

@@ -9,6 +9,6 @@ class PhraseaRecoverPasswordFormTest extends FormTestCase
{
protected function getForm()
{
return new PhraseaRecoverPasswordForm(self::$DI['app']);
return new PhraseaRecoverPasswordForm(self::$DI['app']['tokens']);
}
}