TYPO3 CMS  TYPO3_6-2
KeypairTest.php
Go to the documentation of this file.
1 <?php
3 
18 
28  protected $subject = NULL;
29 
30  public function setUp() {
31  $this->subject = new Keypair();
32  }
33 
37  public function classIsSingleton() {
38  $this->assertInstanceOf(
39  'TYPO3\\CMS\\Core\\SingletonInterface',
40  $this->subject
41  );
42  }
43 
47  public function getExponentInitiallyReturnsZero() {
48  $this->assertSame(
49  0,
50  $this->subject->getExponent()
51  );
52  }
53 
57  public function setExponentSetsExponent() {
58  $this->subject->setExponent(123456);
59 
60  $this->assertSame(
61  123456,
62  $this->subject->getExponent()
63  );
64  }
65 
72  $this->subject->setExponent(123456);
73  $this->subject->setExponent(123456);
74  }
75 
80  $this->assertSame(
81  '',
82  $this->subject->getPrivateKey()
83  );
84  }
85 
89  public function setPrivateKeySetsPrivateKey() {
90  $this->subject->setPrivateKey('foo bar');
91 
92  $this->assertSame(
93  'foo bar',
94  $this->subject->getPrivateKey()
95  );
96  }
97 
104  $this->subject->setPrivateKey('foo');
105  $this->subject->setPrivateKey('foo');
106  }
107 
112  $this->assertSame(
113  0,
114  $this->subject->getPublicKeyModulus()
115  );
116  }
117 
122  $this->subject->setPublicKey(123456);
123 
124  $this->assertSame(
125  123456,
126  $this->subject->getPublicKeyModulus()
127  );
128  }
129 
136  $this->subject->setPublicKey(123456);
137  $this->subject->setPublicKey(123456);
138  }
139 
144  $this->subject->setExponent(1861234);
145  $this->subject->setPrivateKey('lkjasbe');
146  $this->subject->setPublicKey(745786268712);
147 
148  $this->assertTrue(
149  $this->subject->isReady()
150  );
151  }
152 
157  $this->assertFalse(
158  $this->subject->isReady()
159  );
160  }
161 
166  $this->subject->setExponent(1861234);
167  $this->subject->setPrivateKey('lkjasbe');
168 
169  $this->assertFalse(
170  $this->subject->isReady()
171  );
172  }
173 
178  $this->subject->setExponent(1861234);
179  $this->subject->setPublicKey(745786268712);
180 
181  $this->assertFalse(
182  $this->subject->isReady()
183  );
184  }
185 
190  $this->subject->setPrivateKey('lkjasbe');
191  $this->subject->setPublicKey(745786268712);
192 
193  $this->assertFalse(
194  $this->subject->isReady()
195  );
196  }
197 }