## Embedded Posts

This README is for the setup of a development environment for the Embedded Posts WordPress plugins.

For instructions on how to use the Embedded Posts plugin within a WordPress environment, please consult the [readme.txt](https://gitlab.com/cooperativeit/embedded-posts/-/blob/main/readme.txt).

## Table of Contents

 - [WP-ENV setup](#wp-env-setup)
   - [Bring up WP-ENV](#bring-up-wp-env)
   - [URL](#url)
   - [Bring down WP-ENV](#bring-down-wp-env)
 - [PHP Unit](#php-unit)
   - [Install PHPUnit-Polyfills](#install-phpunit-polyfills)
   - [Run PHP Unit Migrate](#run-php-unit-migrate)
   - [Run PHP Unit](#run-php-unit)
 - [Test Data](#test-data)


## WP-ENV setup

Your system will need to meet the minimum prerequisites as stated in [@wordpress/env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/#prerequisites).

Further reference:
https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/

    git clone git@gitlab.com:cooperativeit/embedded-posts.git
    cd embedded-posts
    npm install --save-dev @wordpress/scripts && npm install @wordpress/env --save-dev

### Bring up WP-ENV

    npm run wp-env start

### URL

    http://localhost:8888/wp-admin/

u: admin
p: password

### Bring down WP-ENV
(This needs to be running for the tests)

    npm run wp-env stop

## PHP Unit

### Install PHPUnit-Polyfills

    git clone https://github.com/Yoast/PHPUnit-Polyfills.git

### Run PHP Unit Migrate
You may need to run this command

    npm run phpunit:migrate

### Run PHP Unit

    npm run phpunit

## Test Data
In the test data folder, there are two files containing test posts, which can be imported using the standard WordPress importer.
