Skip to content

Commit

Permalink
Merge 3409e27 into 2541edc
Browse files Browse the repository at this point in the history
  • Loading branch information
kilip committed Aug 21, 2018
2 parents 2541edc + 3409e27 commit 7eeed92
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 29 deletions.
4 changes: 2 additions & 2 deletions features/organization/profile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ Feature: Organization profile

Scenario: Access disabled organization profile
Given I go to profile page for organization "Profile Disabled"
Then I should see "This Organization Profile is disabled"
Then I should see "This profile is disabled."

Scenario: Access profile when there are no active jobs
Given organization "Profile Active Job" have no job
And I go to profile page for organization "Profile Active Jobs"
Then I should see "This Organization Profile is disabled"
Then I should see "This profile is disabled."

Scenario: Filter organization profile by user roles
Given I have a recruiter with the following:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public function testIndexAction()

/* @var ViewModel $result */
$result = $target->indexAction();
$this->assertArrayHasKey('foo',$result->getVariables());
$this->assertEquals('bar',$result->getVariable('foo'));
$this->assertArrayHasKey('foo', $result->getVariables());
$this->assertEquals('bar', $result->getVariable('foo'));
}

public function testIndexThrowsExceptionOnNullID()
Expand All @@ -110,11 +110,12 @@ public function testIndexThrowsExceptionOnNullID()
$target = $this->target;
$target->setPluginManager($pluginManager);
$return = $target->detailAction();
$this->assertArrayHasKey('message',$return);
$this->assertArrayHasKey('exception',$return);
$this->assertArrayHasKey('message', $return);
$this->assertArrayHasKey('exception', $return);
$this->assertRegExp(
'/Null Organization/',
$return['exception']->getMessage())
$return['exception']->getMessage()
)
;
}

Expand All @@ -131,7 +132,7 @@ public function testDetailThrowNotFoundWhenOrganizationIsNotFound()

$params->expects($this->any())
->method('__invoke')
->with('id',null)
->with('id', null)
->willReturn('some-id')
;

Expand All @@ -142,7 +143,7 @@ public function testDetailThrowNotFoundWhenOrganizationIsNotFound()
$target->detailAction();
}

public function testIndexThrowUnauthorizedWhenProfileDisabled()
public function testIndexShouldRenderDisabledProfile()
{
$plugins = $this->createMock(PluginManager::class);
$params = $this->createMock(Params::class);
Expand All @@ -155,7 +156,7 @@ public function testIndexThrowUnauthorizedWhenProfileDisabled()

$params->expects($this->any())
->method('__invoke')
->with('id',null)
->with('id', null)
->willReturn('some-id')
;

Expand All @@ -169,9 +170,9 @@ public function testIndexThrowUnauthorizedWhenProfileDisabled()
;
$target = $this->target;
$target->setPluginManager($plugins);
$this->expectException(UnauthorizedAccessException::class);
$this->expectExceptionMessage('This Organization Profile is disabled');
$target->detailAction();
/* @var ViewModel $result */
$result = $target->detailAction();
$this->assertEquals('organizations/profile/disabled', $result->getTemplate());
}

public function testDetailShouldReturnOrganizationWithGivenId()
Expand All @@ -187,7 +188,7 @@ public function testDetailShouldReturnOrganizationWithGivenId()

$params->expects($this->any())
->method('__invoke')
->with('id',null)
->with('id', null)
->willReturn('some-id')
;

Expand All @@ -204,12 +205,12 @@ public function testDetailShouldReturnOrganizationWithGivenId()

/* @var \Zend\View\Model\ViewModel $retVal */
$retVal = $target->detailAction();
$this->assertInstanceOf(ViewModel::class,$retVal);
$this->assertArrayHasKey('organization',$retVal->getVariables());
$this->assertEquals($entity,$retVal->getVariable('organization'));
$this->assertInstanceOf(ViewModel::class, $retVal);
$this->assertArrayHasKey('organization', $retVal->getVariables());
$this->assertEquals($entity, $retVal->getVariable('organization'));
}

public function testDetailThrowUnauthorizedWhenNoActiveJobs()
public function testDetailShouldRenderDisabledProfileWhenNoActiveJobs()
{
$pluginManager = $this->createMock(PluginManager::class);
$params = $this->createMock(Params::class);
Expand All @@ -222,7 +223,7 @@ public function testDetailThrowUnauthorizedWhenNoActiveJobs()

$params->expects($this->any())
->method('__invoke')
->with('id',null)
->with('id', null)
->willReturn('some-id')
;

Expand All @@ -246,12 +247,6 @@ public function testDetailThrowUnauthorizedWhenNoActiveJobs()
->getMock()
;


$this->translator->expects($this->once())
->method('translate')
->with('This Organization Profile is disabled')
->willReturn('translated-message')
;
$paginator = $this->createMock(Paginator::class);
$paginator->expects($this->once())
->method('getTotalItemCount')
Expand All @@ -265,9 +260,7 @@ public function testDetailThrowUnauthorizedWhenNoActiveJobs()
;
$target->setPluginManager($pluginManager);


$this->expectException(UnauthorizedAccessException::class);
$this->expectExceptionMessage('translated-message');
$target->detailAction();
$result = $target->detailAction();
$this->assertEquals('organizations/profile/disabled', $result->getTemplate());
}
}

0 comments on commit 7eeed92

Please sign in to comment.