Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 62 additions & 62 deletions tests/Handlers/AccountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -599,66 +599,66 @@ public function testResendEmailVerificationError(): void
Account::resendEmailVerification($req);
}

/** These tests are frail, going to comment to ship and then address why they fail **/
// public function testGetAccountPageDefaultFree(): void
// {
// $page = "";
//
// $req = new RequestContext([]);
// $user = new User();
// $user->setUserId(12345);
// $req->setUser($user);
//
// $client = $this->createMock(CPClient::class);
// $client->expects($this->once())
// ->method('getFullWptPlanSet');
// $client->expects($this->once())
// ->method('getUserContactInfo')
// ->with(12345)
// ->willReturn([
// 'firstName' => "Goober",
// 'lastName' => "Goob",
// 'companyName' => ""
// ]);
// $req->setClient($client);
//
// $bmm = $this->createMock(BannerMessageManager::class);
// $bmm->expects($this->once())
// ->method('get')
// ->willReturn([]);
// $req->setBannerMessageManager($bmm);
//
// Account::getAccountPage($req, $page);
// }
//
// public function testGetAccountPageDefaultFreeCompanyNull(): void
// {
// $page = "";
//
// $req = new RequestContext([]);
// $user = new User();
// $user->setUserId(12345);
// $req->setUser($user);
//
// $client = $this->createMock(CPClient::class);
// $client->expects($this->once())
// ->method('getFullWptPlanSet');
// $client->expects($this->once())
// ->method('getUserContactInfo')
// ->with(12345)
// ->willReturn([
// 'firstName' => "Goober",
// 'lastName' => "Goob",
// 'companyName' => null
// ]);
// $req->setClient($client);
//
// $bmm = $this->createMock(BannerMessageManager::class);
// $bmm->expects($this->once())
// ->method('get')
// ->willReturn([]);
// $req->setBannerMessageManager($bmm);
//
// Account::getAccountPage($req, $page);
// }
public function testGetAccountPageDefaultFree(): void
{
$page = "";

$req = new RequestContext([]);
$user = new User();
$user->setUserId(12345);
$req->setUser($user);

$client = $this->createMock(CPClient::class);
$client->expects($this->once())
->method('getFullWptPlanSet');
$client->expects($this->once())
->method('getUserContactInfo')
->with(12345)
->willReturn([
'firstName' => "Goober",
'lastName' => "Goob",
'companyName' => ""
]);
$req->setClient($client);

$bmm = $this->createMock(BannerMessageManager::class);
$bmm->expects($this->once())
->method('get')
->willReturn([]);
$req->setBannerMessageManager($bmm);

$_GLOBALS['request_context'] = $req;
Account::getAccountPage($req, $page);
}

public function testGetAccountPageDefaultFreeCompanyNull(): void
{
$page = "";

$req = new RequestContext([]);
$user = new User();
$user->setUserId(12345);
$req->setUser($user);

$client = $this->createMock(CPClient::class);
$client->expects($this->once())
->method('getFullWptPlanSet');
$client->expects($this->once())
->method('getUserContactInfo')
->with(12345)
->willReturn([
'firstName' => "Goober",
'lastName' => "Goob",
'companyName' => null
]);
$req->setClient($client);

$bmm = $this->createMock(BannerMessageManager::class);
$bmm->expects($this->once())
->method('get')
->willReturn([]);
$req->setBannerMessageManager($bmm);

Account::getAccountPage($req, $page);
}
}
4 changes: 3 additions & 1 deletion www/templates/layouts/includes/wpt-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ function addTab($tabName, $tabUrl, $addClass = '')
</div>
<div class="wptheader_nav_menu_section">
<?php
if (!(!is_null($request_context->getUser()) && $request_context->getUser()->isPaid() )) {
$user_exists = !is_null($request_context) && !is_null($request_context->getUser());
$is_paid_user = $user_exists && $request_context->getUser()->isPaid();
if (!$is_paid_user) {
?>
<p class="wptheader_nav_cta">
<span>Ready to go <strong>Pro?</strong></span>
Expand Down