Skip to content

Commit

Permalink
Merge pull request #531 from hmrc/DDCE-5464
Browse files Browse the repository at this point in the history
DDCE-5464: Upgrade play frontend and removed mockito-scala-scalatest
  • Loading branch information
gastonracui authored Jul 1, 2024
2 parents c8c147d + d5a6427 commit 4cbdea9
Show file tree
Hide file tree
Showing 39 changed files with 134 additions and 283 deletions.
4 changes: 0 additions & 4 deletions app/assets/javascripts/html5shiv.min.js

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/application-ie-8.scss

This file was deleted.

4 changes: 2 additions & 2 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$govuk-assets-path: "/declare-commercial-goods/assets/lib/govuk-frontend/govuk/assets/";
$govuk-assets-path: "/declare-commercial-goods/assets/lib/govuk-frontend/dist/govuk/assets/";
$hmrc-assets-path: "/declare-commercial-goods/assets/lib/hmrc-frontend/hmrc/";

@import "lib/govuk-frontend/govuk/all";
@import "lib/govuk-frontend/dist/govuk/all";
@import "lib/hmrc-frontend/hmrc/all";
@import "autocomplete";
@import "language-selection";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@import uk.gov.hmrc.merchandiseinbaggage.utils.DateUtils._
@import uk.gov.hmrc.merchandiseinbaggage.controllers.DeclarationJourneyRequest

@this(layout: Layout, formHelper: FormWithCSRF, errorSummary: components.errorSummary, summaryList: includes.goodsSummary, button: components.button)
@this(layout: Layout, govukWarningText: GovukWarningText, formHelper: FormWithCSRF, errorSummary: components.errorSummary, summaryList: includes.goodsSummary, button: components.button)

@(form: Form[_], declaration: Declaration, isAgent: YesNo)(implicit request: DeclarationJourneyRequest[_], messages: Messages, appConfig: AppConfig)

Expand Down Expand Up @@ -186,13 +186,10 @@ <h2 class="govuk-heading-m">@messages(s"checkYourAnswers.${agentOrTrader}.sendDe

<p class="govuk-body">@messages("checkYourAnswers.sendDeclaration.confirm")</p>

<div class="govuk-warning-text">
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
<strong class="govuk-warning-text__text">
<span class="govuk-warning-text__assistive">@messages("checkYourAnswers.sendDeclaration.warning")</span>
@messages(s"checkYourAnswers.sendDeclaration.warning.Export.${agentOrTrader}.message")
</strong>
</div>
@govukWarningText(WarningText(
iconFallbackText = Some(messages("checkYourAnswers.sendDeclaration.warning")),
content = Text(messages(s"checkYourAnswers.sendDeclaration.warning.Export.${agentOrTrader}.message"))
))

@button(messages("checkYourAnswers.makeDeclarationButton"), name = Some("makeDeclarationButton"))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@import uk.gov.hmrc.merchandiseinbaggage.utils.DataModelEnriched._
@import uk.gov.hmrc.merchandiseinbaggage.controllers.DeclarationJourneyRequest

@this(layout: Layout, formHelper: FormWithCSRF, errorSummary: components.errorSummary, summaryList: includes.goodsSummary, button: components.button)
@this(layout: Layout, govukWarningText: GovukWarningText, formHelper: FormWithCSRF, errorSummary: components.errorSummary, summaryList: includes.goodsSummary, button: components.button)

@(form: Form[_], declaration: Declaration, calculationResults: CalculationResults, isAgent: YesNo)(implicit request: DeclarationJourneyRequest[_], messages: Messages, appConfig: AppConfig)

Expand Down Expand Up @@ -198,13 +198,10 @@ <h2 class="govuk-heading-m">@messages(s"checkYourAnswers.${agentOrTrader}.sendDe

<p class="govuk-body">@messages("checkYourAnswers.sendDeclaration.confirm")</p>

<div class="govuk-warning-text">
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
<strong class="govuk-warning-text__text">
<span class="govuk-warning-text__assistive">@messages("checkYourAnswers.sendDeclaration.warning")</span>
@messages(s"checkYourAnswers.sendDeclaration.warning.Import.${agentOrTrader}.message")
</strong>
</div>
@govukWarningText(WarningText(
iconFallbackText = Some(messages("checkYourAnswers.sendDeclaration.warning")),
content = Text(messages(s"checkYourAnswers.sendDeclaration.warning.Import.${agentOrTrader}.message"))
))

<input id="@taxDue" type="hidden" name="@taxDue" value="@calculationResults.totalTaxDue.value">

Expand Down
23 changes: 0 additions & 23 deletions app/uk/gov/hmrc/merchandiseinbaggage/views/Head.scala.html

This file was deleted.

19 changes: 11 additions & 8 deletions app/uk/gov/hmrc/merchandiseinbaggage/views/Layout.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
*@

@import views.html.helper.CSPNonce
@import uk.gov.hmrc.merchandiseinbaggage.views.html.{Head, layouts}
@import uk.gov.hmrc.merchandiseinbaggage.views.html.layouts
@import uk.gov.hmrc.merchandiseinbaggage.config.AppConfig
@import uk.gov.hmrc.merchandiseinbaggage.model.api.DeclarationType
@import uk.gov.hmrc.hmrcfrontend.views.html.components._
@import uk.gov.hmrc.hmrcfrontend.views.html.helpers._
@import uk.gov.hmrc.merchandiseinbaggage.controllers.routes._

@this(
govukLayout: layouts.govukLayout,
head: Head,
hmrcHead: HmrcHead,
hmrcScripts: HmrcScripts,
hmrcTimeoutDialog: HmrcTimeoutDialog
)

Expand All @@ -38,6 +40,8 @@

@defaultHead = {
@headBlock
<!--[if gt IE 8]><!--><link href='@controllers.routes.Assets.versioned("stylesheets/application.css")' media="all" rel="stylesheet" type="text/css" /><!--<![endif]-->

@{if(timeOut) hmrcTimeoutDialog(TimeoutDialog(
timeout= Some(appConfig.timeout),
countdown= Some(appConfig.countdown),
Expand All @@ -61,18 +65,17 @@

@defaultScripts = {
<script @{CSPNonce.attr} src="@routes.Assets.versioned("javascripts/jquery-3.5.1.min.js")"></script>
<script @{CSPNonce.attr} src='@controllers.routes.Assets.versioned("lib/govuk-frontend/govuk/all.js")'></script>
<script @{CSPNonce.attr} src='@controllers.routes.Assets.versioned("lib/hmrc-frontend/hmrc/all.js")'></script>
<script @{CSPNonce.attr} src="@routes.Assets.versioned("javascripts/timeoutDialog.js")"></script>
<script @{CSPNonce.attr} src="@routes.Assets.versioned("javascripts/application.js")"></script>

@scriptsBlock
}

@if(isAssistedDigital) {
@govukLayout(
pageTitle = pageTitle,
headBlock = Some(head(Some(defaultHead))),
scriptsBlock = Some(defaultScripts),
headBlock = Some(hmrcHead(headBlock = Some(defaultHead))),
scriptsBlock = Some(hmrcScripts(scriptsBlock = Some(defaultScripts))),
beforeContentBlock = None,
maybeBackButtonUrl = maybeBackButtonUrl,
declarationType = None,
Expand All @@ -81,8 +84,8 @@
} else {
@govukLayout(
pageTitle = pageTitle,
headBlock = Some(head(Some(defaultHead))),
scriptsBlock = Some(defaultScripts),
headBlock = Some(hmrcHead(headBlock = Some(defaultHead))),
scriptsBlock = Some(hmrcScripts(scriptsBlock = Some(defaultScripts))),
beforeContentBlock = None,
maybeBackButtonUrl = maybeBackButtonUrl,
declarationType = maybeDeclarationType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,14 @@
@import uk.gov.hmrc.merchandiseinbaggage.views.html.{Layout, components}
@import uk.gov.hmrc.merchandiseinbaggage.controllers.routes._
@import uk.gov.hmrc.merchandiseinbaggage.model.core.PurchaseDetailsInput
@import uk.gov.hmrc.hmrcfrontend.views.html.components.HmrcCurrencyInput
@import uk.gov.hmrc.merchandiseinbaggage.model.api.DeclarationType.Export
@import uk.gov.hmrc.hmrcfrontend.views.Aliases.CurrencyInput
@import uk.gov.hmrc.merchandiseinbaggage.controllers.DeclarationGoodsRequest

@this(
govukInput: GovukInput,
layout: Layout,
formHelper: FormWithCSRF,
h1: components.h1,
errorSummary: components.errorSummary,
text: components.inputText,
currencyInput: HmrcCurrencyInput,
button: components.button
)

Expand All @@ -50,11 +46,15 @@ <h1 class="govuk-fieldset__legend govuk-fieldset__legend--xl">

<div class="govuk-inset-text">@messages("purchaseDetails.type.of.goods")<strong> @goodsCategory</strong></div>

@currencyInput(
CurrencyInput(
id = "price", name = "price",
@govukInput(
Input(
id = "price",
name = "price",
classes = "govuk-input--width-10",
value = form("price").value
value = form("price").value,
prefix = Some(PrefixOrSuffix(
content = Text("£")
))
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
govukBackLink: GovukBackLink,
languageSelection: components.languageSelection,
hmrcReportTechnicalIssueHelper: HmrcReportTechnicalIssueHelper,
hmrcTrackingConsentSnippet: HmrcTrackingConsentSnippet,
hmrcStandardFooter: HmrcStandardFooter,
govukSkipLink: GovukSkipLink,
siteHeader: components.siteHeader,
Expand All @@ -48,12 +47,6 @@
isAssistedDigital: Boolean
)(contentBlock: Html)(implicit messages: Messages, request: Request[_])

@headDefault = {
@headBlock
@hmrcTrackingConsentSnippet()
}


@headerDefault = {
@if(isAssistedDigital) {
@siteHeader()
Expand Down Expand Up @@ -119,7 +112,7 @@
@govukTemplate(
htmlLang = Some(messages.lang.code),
pageTitle = pageTitle,
headBlock = Some(headDefault),
headBlock = headBlock,
headerBlock = headerDefault,
beforeContentBlock = Some(beforeContentDefault),
footerBlock = hmrcStandardFooter(),
Expand Down
14 changes: 1 addition & 13 deletions conf/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,13 @@
</encoder>
</appender>

<appender name="ACCESS_LOG_FILE" class="ch.qos.logback.core.FileAppender">
<file>logs/access.log</file>
<encoder>
<pattern>%message%n</pattern>
</encoder>
</appender>

<appender name="CONNECTOR_LOG_FILE" class="ch.qos.logback.core.FileAppender">
<file>logs/connector.log</file>
<encoder>
<pattern>%message%n</pattern>
</encoder>
</appender>


<logger name="accesslog" level="INFO" additivity="false">
<appender-ref ref="ACCESS_LOG_FILE" />
</logger>

<logger name="com.google.inject" level="INFO"/>

<logger name="uk.gov" level="INFO"/>
Expand All @@ -51,4 +39,4 @@
<appender-ref ref="FILE"/>
<appender-ref ref="STDOUT"/>
</root>
</configuration>
</configuration>
11 changes: 5 additions & 6 deletions project/AppDependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ object AppDependencies {

private val compile: Seq[ModuleID] = Seq(
"uk.gov.hmrc" %% "bootstrap-frontend-play-30" % bootstrapVersion,
"uk.gov.hmrc" %% "play-frontend-hmrc-play-30" % "8.5.0",
"uk.gov.hmrc.mongo" %% "hmrc-mongo-play-30" % "1.9.0",
"uk.gov.hmrc" %% "play-frontend-hmrc-play-30" % "10.1.0",
"uk.gov.hmrc.mongo" %% "hmrc-mongo-play-30" % "2.1.0",
"com.beachape" %% "enumeratum-play" % "1.8.0",
"org.webjars.npm" % "accessible-autocomplete" % "2.0.4",
"com.softwaremill.quicklens" %% "quicklens" % "1.9.7",
"org.typelevel" %% "cats-core" % "2.12.0",
"io.github.samueleresca" %% "pekko-quartz-scheduler" % "1.2.0-pekko-1.0.x"
"io.github.samueleresca" %% "pekko-quartz-scheduler" % "1.2.1-pekko-1.0.x"
)

private val test: Seq[ModuleID] = Seq(
"uk.gov.hmrc" %% "bootstrap-test-play-30" % bootstrapVersion,
"org.scalatestplus" %% "scalacheck-1-17" % "3.2.18.0",
"org.mockito" %% "mockito-scala-scalatest" % "1.17.31"
"uk.gov.hmrc" %% "bootstrap-test-play-30" % bootstrapVersion,
"org.scalatestplus" %% "scalacheck-1-18" % "3.2.19.0"
).map(_ % Test)

// only add additional dependencies here - it test inherit test dependencies above already
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.scalastyle" % "scalastyle-sbt-plugin" % "1.0.0" exclude ("org.scala-lang.modules", "scala-xml_2.12"))
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.12")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")
addSbtPlugin("uk.gov.hmrc" % "sbt-accessibility-linter" % "0.39.0")
addSbtPlugin("uk.gov.hmrc" % "sbt-accessibility-linter" % "1.0.0")
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package uk.gov.hmrc.merchandiseinbaggage.controllers

import org.mockito.ArgumentMatchersSugar.any
import org.mockito.MockitoSugar.{mock, when}
import org.mockito.ArgumentMatchers.any
import org.mockito.Mockito.{mock, when}
import play.api.mvc.Result
import play.api.test.Helpers._
import uk.gov.hmrc.merchandiseinbaggage.controllers.routes._
Expand All @@ -33,7 +33,7 @@ import scala.concurrent.{ExecutionContext, Future}
class AgentDetailsControllerSpec extends DeclarationJourneyControllerSpec {

private val view: AgentDetailsView = app.injector.instanceOf[AgentDetailsView]
private val mockNavigator: Navigator = mock[Navigator]
private val mockNavigator: Navigator = mock(classOf[Navigator])

def controller(declarationJourney: DeclarationJourney): AgentDetailsController =
new AgentDetailsController(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

package uk.gov.hmrc.merchandiseinbaggage.controllers

import org.mockito.ArgumentMatchersSugar.{any, eqTo}
import org.mockito.MockitoSugar.{mock, when}
import org.mockito.ArgumentMatchers.{any, eq => eqTo}
import org.mockito.Mockito.{mock, when}
import play.api.mvc.{Request, Result}
import play.api.test.Helpers._
import uk.gov.hmrc.http.HeaderCarrier
Expand All @@ -42,9 +42,9 @@ class CheckYourAnswersAmendHandlerSpec extends DeclarationJourneyControllerSpec
private val importView: CheckYourAnswersAmendImportView = injector.instanceOf[CheckYourAnswersAmendImportView]
private val exportView: CheckYourAnswersAmendExportView = injector.instanceOf[CheckYourAnswersAmendExportView]
private val mibConnector: MibConnector = injector.instanceOf[MibConnector]
private val mockTpsPaymentsService: TpsPaymentsService = mock[TpsPaymentsService]
private val paymentService: PaymentService = mock[PaymentService]
private val mockMibService: MibService = mock[MibService]
private val mockTpsPaymentsService: TpsPaymentsService = mock(classOf[TpsPaymentsService])
private val paymentService: PaymentService = mock(classOf[PaymentService])
private val mockMibService: MibService = mock(classOf[MibService])

private val sessionId: SessionId = SessionId()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
package uk.gov.hmrc.merchandiseinbaggage.controllers

import cats.data.OptionT
import org.mockito.ArgumentMatchersSugar.any
import org.mockito.MockitoSugar.{mock, when}
import org.mockito.ArgumentMatchers.any
import org.mockito.Mockito.{mock, when}
import play.api.mvc.Results._
import play.api.mvc.{Request, RequestHeader, Result}
import play.api.test.Helpers._
Expand Down Expand Up @@ -51,8 +51,8 @@ class CheckYourAnswersControllerSpec extends DeclarationJourneyControllerSpec {
private val mibConnector: MibConnector = injector.instanceOf[MibConnector]
private val auditConnector: AuditConnector = injector.instanceOf[AuditConnector]

private val mockMibService: MibService = mock[MibService]
private val mockTpsService: TpsPaymentsService = mock[TpsPaymentsService]
private val mockMibService: MibService = mock(classOf[MibService])
private val mockTpsService: TpsPaymentsService = mock(classOf[TpsPaymentsService])

private lazy val testPaymentConnector: PaymentConnector = new PaymentConnector(appConfig, httpClient) {
override def sendPaymentRequest(
Expand Down Expand Up @@ -162,8 +162,8 @@ class CheckYourAnswersControllerSpec extends DeclarationJourneyControllerSpec {
val sessionId = SessionId()
val journey: DeclarationJourney =
completedDeclarationJourney.copy(sessionId = sessionId, journeyType = journeyType, isAssistedDigital = true)
val mockHandler: CheckYourAnswersNewHandler = mock[CheckYourAnswersNewHandler]
val mockAmendHandler: CheckYourAnswersAmendHandler = mock[CheckYourAnswersAmendHandler]
val mockHandler: CheckYourAnswersNewHandler = mock(classOf[CheckYourAnswersNewHandler])
val mockAmendHandler: CheckYourAnswersAmendHandler = mock(classOf[CheckYourAnswersAmendHandler])

def controller(declarationJourney: DeclarationJourney): CheckYourAnswersController =
new CheckYourAnswersController(
Expand Down
Loading

0 comments on commit 4cbdea9

Please sign in to comment.