Skip to main content

TrustedLogin Connector Plugin Development

Plugin to interact with TrustedLogin's encrypted storage infrastructure to redirect support staff into an authenticated session on client installations.

To Compile

The plugin will need to be built. Here's how:

  1. Change directories to the plugin directory (cd /path/to/directory)
  2. Run composer install --no-dev

Code Standards Installation

  1. Change directories to the plugin directory (cd /path/to/directory)
  2. Run composer install - this will also install the code standards directory
  3. Run ./vendor/bin/phpcs

Local Development Environment

A docker-compose-based local development environment is provided.

  • Start server
    • docker-compose up -d
  • Acess Site
  • Run WP CLI command:
    • docker-compose run wp cli wp ...
    • docker-compose run wpcli wp db reset

In the local development container, the constant DOING_TL_VENDOR_TESTS is set to true, as is WP_DEBUG.

Running PHPUnit in Docker

There is a special phpunit container for running WordPress tests, with WordPress and MySQL configured.

  • Enter container
    • docker-compose run phpunit
  • Test
    • phpunit

Server-to-Server HTTP Requests

If the eCommerce app (the SaaS) is also running in docker-compose, this WordPress and the "web" service of app should be in tl-dev network. This allows you to make an HTTP request to the eCommerce app like this:

$r = wp_remote_get( 'http://web:80', ['sslverify' => false] );

If this doesn't work, make sure a tl-dev network exists:

docker network ls

If it does not, create one:

docker network create tl-dev