Skip to content
This repository has been archived by the owner on Jan 18, 2018. It is now read-only.

Commit

Permalink
Removed old code
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Mar 12, 2015
1 parent 1f8d24a commit 267c486
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 137 deletions.
32 changes: 0 additions & 32 deletions tests/EloquentGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,38 +52,6 @@ public function testGroupName()
$this->assertEquals('foo', $group->getName());
}

// public function testSettingPermissions()
// {
// $permissions = array(
// 'foo' => 1,
// 'bar' => 1,
// 'baz' => 1,
// 'qux' => 1,
// );

// $group = new Group;

// $expected = '{"foo":1,"bar":1,"baz":1,"qux":1}';

// $this->assertEquals($expected, $group->setPermissions($permissions));
// }

// public function testSettingPermissionsWhenSomeAreSetTo0()
// {
// $permissions = array(
// 'foo' => 1,
// 'bar' => 1,
// 'baz' => 0,
// 'qux' => 1,
// );

// $group = new Group;

// $expected = '{"foo":1,"bar":1,"qux":1}';

// $this->assertEquals($expected, $group->setPermissions($permissions));
// }

public function testPermissionsAreMergedAndRemovedProperly()
{
$group = new Group();
Expand Down
105 changes: 0 additions & 105 deletions tests/EloquentThrottleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,111 +134,6 @@ public function testUnsuspend()
$this->assertNull($throttle->suspended_at);
}

// public function testIsSuspended()
// {
// $throttle = new Throttle;
// $this->assertFalse($throttle->isSuspended());
// }

// public function testIsSuspendedRemovesSuspensionIfEnoughTimeHasPassed()
// {
// $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[save]');
// $throttle->shouldReceive('save')->once();
// $throttle->suspended = true;


// // Still suspended
// $throttle->setSuspensionTime(11);
// $suspendedAt = new DateTime;
// $suspendedAt->modify('-10 minutes');
// $throttle->suspended_at = $suspendedAt;

// $this->assertTrue($throttle->isSuspended());

// // Unsuspend time, because suspension time is 9
// // minutes however we were suspended at 10 minutes
// // ago
// $throttle->setSuspensionTime(9);
// $this->assertFalse($throttle->isSuspended());
// }

// public function testAddLoginAttempt()
// {
// $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[suspend,save]');
// $throttle->shouldReceive('save')->once();
// $throttle->shouldReceive('suspend')->once();

// $throttle->setAttemptLimit(5);
// $throttle->attempts = 3;

// $throttle->addLoginAttempt();
// $this->assertEquals(4, $throttle->getLoginAttempts());

// $throttle->addLoginAttempt();
// $this->assertEquals(5, $throttle->getLoginAttempts());
// }

// public function testBanning()
// {
// $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[save]');
// $throttle->shouldReceive('save')->twice();

// $throttle->ban();
// $this->assertTrue($throttle->isBanned());
// $throttle->unban();
// $this->assertFalse($throttle->isBanned());
// }

// /**
// * @expectedException Cartalyst\Sentry\Throttling\UserBannedException
// */
// public function testCheckingThrowsProperExceptionWhenUserIsBanned()
// {
// $user = m::mock('Cartalyst\Sentry\Users\UserInterface');
// $user->shouldReceive('getLogin')->once()->andReturn('foo');

// $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[isBanned,isSuspended,getUser]');
// $throttle->shouldReceive('isBanned')->once()->andReturn(true);
// $throttle->shouldReceive('isSuspended')->never();
// $throttle->shouldReceive('getUser')->once()->andReturn($user);

// $throttle->check();
// }

// /**
// * @expectedException Cartalyst\Sentry\Throttling\UserSuspendedException
// */
// public function testCheckingThrowsProperExceptionWhenUserIsSuspended()
// {
// $user = m::mock('Cartalyst\Sentry\Users\UserInterface');
// $user->shouldReceive('getLogin')->once()->andReturn('foo');

// $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[isBanned,isSuspended,getUser]');
// $throttle->shouldReceive('isBanned')->once()->andReturn(false);
// $throttle->shouldReceive('isSuspended')->once()->andReturn(true);
// $throttle->shouldReceive('getUser')->once()->andReturn($user);

// $throttle->check();
// }

// public function testCheckingWhenUserIsOkay()
// {
// $throttle = m::mock('Cartalyst\Sentry\Throttling\Eloquent\Throttle[isBanned,isSuspended]');
// $throttle->shouldReceive('isBanned')->once()->andReturn(false);
// $throttle->shouldReceive('isSuspended')->once()->andReturn(false);

// $this->assertTrue($throttle->check());
// }

// public function testEnabling()
// {
// $throttle = new Throttle;
// $throttle->enable();
// $this->assertTrue($throttle->isEnabled());
// $throttle->disable();
// $this->assertFalse($throttle->isEnabled());
// }

protected function addMockConnection($model)
{
$model->setConnectionResolver($resolver = m::mock('Illuminate\Database\ConnectionResolverInterface'));
Expand Down

0 comments on commit 267c486

Please sign in to comment.