diff --git a/aws/resources.py b/aws/resources.py index 8dd948c50..e1327d06c 100644 --- a/aws/resources.py +++ b/aws/resources.py @@ -124,13 +124,14 @@ def create_database_resource(template, database_allocated_storage_parameter, AllocatedStorage=Ref(database_allocated_storage_parameter), DBInstanceClass=Ref(database_class_parameter), Engine='MySQL', - EngineVersion='5.7', + EngineVersion='8.0', MasterUsername=Ref(database_username_parameter), MasterUserPassword=Ref(database_password_parameter), VPCSecurityGroups=[ GetAtt(database_security_group_resource, 'GroupId')], DBSubnetGroupName=Ref(database_subnet_group_resource), - PubliclyAccessible=False + PubliclyAccessible=False, + AllowMajorVersionUpgrade=True ) ) diff --git a/config/local.php b/config/local.php index 1753c1051..c0f320ce8 100644 --- a/config/local.php +++ b/config/local.php @@ -34,17 +34,17 @@ /* * The URI for the Terms and Conditions page. */ - 'tandc_uri' => env('TANDC_URI', Str::finish(config('local.frontend_uri'), '/') . 'terms-and-conditions'), + 'tandc_uri' => env('TANDC_URI', Str::finish(env('FRONTEND_URI', ''), '/') . 'terms-and-conditions'), /* * The URI for the Privacy page. */ - 'privacy_uri' => env('PRIVACY_URI', Str::finish(config('local.frontend_uri'), '/') . 'privacy-policy'), + 'privacy_uri' => env('PRIVACY_URI', Str::finish(env('FRONTEND_URI', ''), '/') . 'privacy-policy'), /* * The URI for the Accessibility page. */ - 'accessibility_uri' => env('ACCESSIBILITY_URI', Str::finish(config('local.frontend_uri'), '/') . 'accessibility_statement'), + 'accessibility_uri' => env('ACCESSIBILITY_URI', Str::finish(env('FRONTEND_URI', ''), '/') . 'accessibility_statement'), /* * The number of working days a service must respond within. diff --git a/docker-compose.yml b/docker-compose.yml index 5b882f169..7e7428e9f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3" +version: '3' services: app: @@ -43,22 +43,22 @@ services: - .:/var/www/html mysql: - image: mysql:5.7 + image: mysql:8.0 environment: - MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASS}" - MYSQL_DATABASE: "${DB_DATABASE}" - MYSQL_USER: "${DB_USERNAME}" - MYSQL_PASSWORD: "${DB_PASSWORD}" + MYSQL_ROOT_PASSWORD: '${DB_ROOT_PASS}' + MYSQL_DATABASE: '${DB_DATABASE}' + MYSQL_USER: '${DB_USERNAME}' + MYSQL_PASSWORD: '${DB_PASSWORD}' volumes: - mysql-data:/var/lib/mysql mysql-testing: - image: mysql:5.7 + image: mysql:8.0 environment: - MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASS}" - MYSQL_DATABASE: "${DB_DATABASE}" - MYSQL_USER: "${DB_USERNAME}" - MYSQL_PASSWORD: "${DB_PASSWORD}" + MYSQL_ROOT_PASSWORD: '${DB_ROOT_PASS}' + MYSQL_DATABASE: '${DB_DATABASE}' + MYSQL_USER: '${DB_USERNAME}' + MYSQL_PASSWORD: '${DB_PASSWORD}' command: mysqld --general-log=1 --general-log-file=/var/log/mysql/general-log.log redis: @@ -72,8 +72,8 @@ services: elasticsearch: image: elasticsearch:7.9.3 environment: - - "discovery.type=single-node" - - "xpack.ml.enabled=false" + - 'discovery.type=single-node' + - 'xpack.ml.enabled=false' volumes: - elasticsearch-data:/usr/share/elasticsearch/data diff --git a/tests/Feature/UpdateRequestsTest.php b/tests/Feature/UpdateRequestsTest.php index 9f261d168..deea58641 100644 --- a/tests/Feature/UpdateRequestsTest.php +++ b/tests/Feature/UpdateRequestsTest.php @@ -14,12 +14,12 @@ use App\Models\UsefulInfo; use App\Events\EndpointHit; use App\Models\SocialMedia; -use Carbon\CarbonImmutable; use App\Models\Organisation; use App\Models\UpdateRequest; use Illuminate\Http\Response; use Laravel\Passport\Passport; use App\Models\ServiceLocation; +use Illuminate\Support\Collection; use Illuminate\Support\Facades\Date; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Queue; @@ -1496,6 +1496,7 @@ public function last_modified_at_is_set_to_now_when_service_updated(): void 'created_at' => $oldNow, 'updated_at' => $oldNow, ]); + $updateRequest = $service->updateRequests()->create([ 'user_id' => User::factory()->create()->id, 'data' => [ @@ -1507,7 +1508,49 @@ public function last_modified_at_is_set_to_now_when_service_updated(): void $response->assertStatus(Response::HTTP_OK); $this->assertDatabaseHas($service->getTable(), [ - 'last_modified_at' => $newNow->format(CarbonImmutable::ISO8601), + 'last_modified_at' => $newNow->toDateTimeString(), + ]); + } + + /** + * @test + */ + public function lastModifiedAtIsUpdatedWhenServiceUpdatedByUpdateRequest() + { + $oldNow = Date::now()->subMonths(6); + $newNow = Date::now(); + Date::setTestNow($newNow); + + $service = Service::factory()->create([ + 'slug' => 'test-service', + 'status' => Service::STATUS_ACTIVE, + 'last_modified_at' => $oldNow, + 'created_at' => $oldNow, + 'updated_at' => $oldNow, + ]); + $taxonomy = Taxonomy::factory()->create(); + $service->syncTaxonomyRelationships(new Collection([$taxonomy])); + $user = User::factory()->create()->makeServiceAdmin($service); + + Passport::actingAs($user); + + $payload = [ + 'name' => 'Test Service', + ]; + $response = $this->json('PUT', "/core/v1/services/{$service->id}", $payload); + + $response->assertStatus(Response::HTTP_OK); + $response->assertJsonFragment(['data' => $payload]); + + $updateRequest = UpdateRequest::find($response->json('id')); + + $this->assertEquals($updateRequest->data, $payload); + + $this->approveUpdateRequest($updateRequest->id); + + $this->assertDatabaseHas($service->getTable(), [ + 'id' => $service->id, + 'last_modified_at' => $newNow->toDateTimeString(), ]); } }