@@ -134,111 +134,6 @@ public function testUnsuspend()
134134 $ this ->assertNull ($ throttle ->suspended_at );
135135 }
136136
137- // public function testIsSuspended()
138- // {
139- // $throttle = new Throttle;
140- // $this->assertFalse($throttle->isSuspended());
141- // }
142-
143- // public function testIsSuspendedRemovesSuspensionIfEnoughTimeHasPassed()
144- // {
145- // $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[save]');
146- // $throttle->shouldReceive('save')->once();
147- // $throttle->suspended = true;
148-
149-
150- // // Still suspended
151- // $throttle->setSuspensionTime(11);
152- // $suspendedAt = new DateTime;
153- // $suspendedAt->modify('-10 minutes');
154- // $throttle->suspended_at = $suspendedAt;
155-
156- // $this->assertTrue($throttle->isSuspended());
157-
158- // // Unsuspend time, because suspension time is 9
159- // // minutes however we were suspended at 10 minutes
160- // // ago
161- // $throttle->setSuspensionTime(9);
162- // $this->assertFalse($throttle->isSuspended());
163- // }
164-
165- // public function testAddLoginAttempt()
166- // {
167- // $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[suspend,save]');
168- // $throttle->shouldReceive('save')->once();
169- // $throttle->shouldReceive('suspend')->once();
170-
171- // $throttle->setAttemptLimit(5);
172- // $throttle->attempts = 3;
173-
174- // $throttle->addLoginAttempt();
175- // $this->assertEquals(4, $throttle->getLoginAttempts());
176-
177- // $throttle->addLoginAttempt();
178- // $this->assertEquals(5, $throttle->getLoginAttempts());
179- // }
180-
181- // public function testBanning()
182- // {
183- // $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[save]');
184- // $throttle->shouldReceive('save')->twice();
185-
186- // $throttle->ban();
187- // $this->assertTrue($throttle->isBanned());
188- // $throttle->unban();
189- // $this->assertFalse($throttle->isBanned());
190- // }
191-
192- // /**
193- // * @expectedException Cartalyst\Sentry\Throttling\UserBannedException
194- // */
195- // public function testCheckingThrowsProperExceptionWhenUserIsBanned()
196- // {
197- // $user = m::mock('Cartalyst\Sentry\Users\UserInterface');
198- // $user->shouldReceive('getLogin')->once()->andReturn('foo');
199-
200- // $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[isBanned,isSuspended,getUser]');
201- // $throttle->shouldReceive('isBanned')->once()->andReturn(true);
202- // $throttle->shouldReceive('isSuspended')->never();
203- // $throttle->shouldReceive('getUser')->once()->andReturn($user);
204-
205- // $throttle->check();
206- // }
207-
208- // /**
209- // * @expectedException Cartalyst\Sentry\Throttling\UserSuspendedException
210- // */
211- // public function testCheckingThrowsProperExceptionWhenUserIsSuspended()
212- // {
213- // $user = m::mock('Cartalyst\Sentry\Users\UserInterface');
214- // $user->shouldReceive('getLogin')->once()->andReturn('foo');
215-
216- // $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[isBanned,isSuspended,getUser]');
217- // $throttle->shouldReceive('isBanned')->once()->andReturn(false);
218- // $throttle->shouldReceive('isSuspended')->once()->andReturn(true);
219- // $throttle->shouldReceive('getUser')->once()->andReturn($user);
220-
221- // $throttle->check();
222- // }
223-
224- // public function testCheckingWhenUserIsOkay()
225- // {
226- // $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[isBanned,isSuspended]');
227- // $throttle->shouldReceive('isBanned')->once()->andReturn(false);
228- // $throttle->shouldReceive('isSuspended')->once()->andReturn(false);
229-
230- // $this->assertTrue($throttle->check());
231- // }
232-
233- // public function testEnabling()
234- // {
235- // $throttle = new Throttle;
236- // $throttle->enable();
237- // $this->assertTrue($throttle->isEnabled());
238- // $throttle->disable();
239- // $this->assertFalse($throttle->isEnabled());
240- // }
241-
242137 protected function addMockConnection ($ model )
243138 {
244139 $ model ->setConnectionResolver ($ resolver = m::mock ('Illuminate\Database\ConnectionResolverInterface ' ));
0 commit comments