Update and export slides

This commit is contained in:
Oliver Davies 2019-03-03 21:25:33 +00:00
parent 242410f8c0
commit fa9e60e6cd
4 changed files with 159 additions and 24 deletions

View file

@ -1,7 +1,7 @@
autoscale: true autoscale: true
build-lists: true build-lists: true
footer-style: alignment(left) footer-style: alignment(left)
footer: @opdavies | oliverdavi.es footer: @opdavies | opdavi.es
header-emphasis: #53B0EB header-emphasis: #53B0EB
header: alignment(left) header: alignment(left)
text: alignment(left) text: alignment(left)
@ -21,17 +21,16 @@ theme: poster, 8
[.header: #111111] [.header: #111111]
[.text: #111111, alignment(left)] [.text: #111111, alignment(left)]
![right 700%](../../me-phpnw.png) ![right 700%](../images/me-phpnw.png)
- Full stack Web Developer & System Administrator - Full stack Web Developer & System Administrator
- Senior Developer at Microserve - Senior Developer at Microserve
- Part-time freelancer - Part-time freelancer
- Acquia certified Drupal 8 Grand Master - Acquia certified Drupal 8 Grand Master
- Drupal 7 & 8 core contributor - Drupal core contributor
- Open source project maintainer - Open source project maintainer
- Drupal Bristol and PHPSW co-organiser
- opdavies (Drupal.org, GitHub, Twitter) - opdavies (Drupal.org, GitHub, Twitter)
- www.oliverdavi.es - www.oliverdavies.uk
^ Work at Microserve. ^ Work at Microserve.
Maintain Drupal modules, PHP CLI tools and libraries Maintain Drupal modules, PHP CLI tools and libraries
@ -57,6 +56,22 @@ Talking about some open source project that I've written or in the process of wr
--- ---
[.hide-footer]
![fit](images/microserve-website.png)
^ In 2018 we rebuilt the Microserve website
---
[.hide-footer]
![fit](images/spatie-website.png)
^ Looking for a way to replicate Spatie's open source page for Drupal
---
### _Did you know that_ ### _Did you know that_
## Drupal.org has an API? ## Drupal.org has an API?
@ -64,12 +79,23 @@ Talking about some open source project that I've written or in the process of wr
--- ---
[.hide-footer]
![fit](images/api-page.png)
---
[.hide-footer]
![fit](images/api-result.png)
---
### _A PHP library for the_ ### _A PHP library for the_
## Drupal.org API ## Drupal.org API
^ The first thing I built was... ^ The first thing I built was...
It's what the Drupal examples are built on top of. It's what the Drupal examples are built on top of.
Does everyone understand what I mean by a PHP library?
--- ---
@ -86,6 +112,24 @@ Demo
--- ---
[.hide-footer]
![fit](images/library-github.png)
---
[.hide-footer]
![fit](images/library-packagist.png)
---
[.hide-footer]
![fit](images/library-travis.png)
---
```bash ```bash
$ composer require opdavies/drupalorg-api-php $ composer require opdavies/drupalorg-api-php
``` ```
@ -111,6 +155,18 @@ $ composer require opdavies/drupalorg-api-php
--- ---
[.hide-footer]
![fit](images/do-projects-settings.png)
---
[.hide-footer]
![fit](images/do-projects-page.png)
---
### _When is your_ ### _When is your_
## Drupalversary? ## Drupalversary?
@ -130,10 +186,16 @@ Demo
--- ---
- oliverdavi.es/_talks_ [.hide-footer]
- oliverdavi.es/_youtube_
- oliverdavi.es/_github_ ![fit](images/drupalversary.png)
- oliverdavi.es/_packagist_
---
- opdavi.es/_talks_
- opdavi.es/_do-library_
- opdavi.es/_drupalversary_
- opdavi.es/_do-projects_
--- ---
@ -146,4 +208,3 @@ Demo
[.header: alignment(center)] [.header: alignment(center)]
# Thanks # Thanks
### joind.in/_24044_

View file

@ -53,7 +53,7 @@ code: Monaco, #6699FF, #999999, #6666FF, #66FF66, #66FF66, line-height(1.3)
- Part-time freelancer - Part-time freelancer
- Acquia certified Drupal 8 Grand Master - Acquia certified Drupal 8 Grand Master
- Drupal 7 & 8 core contributor - Drupal 7 & 8 core contributor
- Symfony, Laravel, ~~Silex,~~ Sculpin - Drupal, Symfony, Laravel, Sculpin
- @opdavies - @opdavies
- www.oliverdavies.uk - www.oliverdavies.uk
@ -91,6 +91,13 @@ Blog on my website
## test_driven_drupal_.com_ ## test_driven_drupal_.com_
^ Book on automated testing in Drupal 8
Building a conference website
---
![80%](images/tdd-drupal-tasks.png)
--- ---
[.header: alignment(center)] [.header: alignment(center)]
@ -124,9 +131,9 @@ Blog on my website
- Used on _11,046 sites_ in October 2012 (_84_ D5, _7,094_ D6, _3,868_ D7) - Used on _11,046 sites_ in October 2012 (_84_ D5, _7,094_ D6, _3,868_ D7)
- Used on _30,572 sites_ in March 2019 (_10_ D5, _1,180_ D6, _24,057_ D7, _5,335_ D8) - Used on _30,572 sites_ in March 2019 (_10_ D5, _1,180_ D6, _24,057_ D7, _5,335_ D8)
- _#230_ most used module on Drupal.org - _#230_ most used module on Drupal.org
- Crucial to preventing regressions when adding new features or fixing bugs - Crucial to preventing regressions
^ Preventing regressions in my additions but also user submitted patches ^ Preventing regressions when adding new features or fixing bugs, but also user submitted patches
First module I ported to Drupal 8, aided by tests First module I ported to Drupal 8, aided by tests
--- ---
@ -159,7 +166,13 @@ ONO merge conflict
- If the feature does not have an implementation, provide a test implementation. - If the feature does not have an implementation, provide a test implementation.
- Bug fixes should be accompanied by changes to a test (either modifying an existing test case or adding a new one) that demonstrate the bug. - Bug fixes should be accompanied by changes to a test (either modifying an existing test case or adding a new one) that demonstrate the bug.
[.footer: https://www.drupal.org/core/gates#testing] [.footer: https://opdavi.es/drupal-core-testing-gate]
---
[.background-color: #FFFFFF]
![fit inline](images/afilina-tweet.png)
--- ---
@ -171,6 +184,10 @@ ONO merge conflict
--- ---
![fit](images/simpletest-countdown.png)
---
[.header: #53B0EB] [.header: #53B0EB]
## Writing Tests (Drupal 8) ## Writing Tests (Drupal 8)
@ -181,7 +198,6 @@ ONO merge conflict
- Class name must match the filename - Class name must match the filename
- Namespace must match the directory structure - Namespace must match the directory structure
- One test class per feature - One test class per feature
- Each method must start with _test_
^ Different to D7 ^ Different to D7
@ -195,6 +211,13 @@ ONO merge conflict
--- ---
[.header: alignment(center)]
## _3._ Assert
## _2._ Act
## _1._ Arrange
---
```php ```php
// modules/example/tests/src/Functional/ExampleTest.php // modules/example/tests/src/Functional/ExampleTest.php
@ -224,6 +247,17 @@ Add test method
--- ---
```php
public function testSomething() {}
public function test_something() {}
/** @test */
public function it_does_something() {}
```
---
[.header: #53B0EB] [.header: #53B0EB]
## What to test? ## What to test?
@ -321,8 +355,6 @@ class JobTest extends UnitTestCase {
^ Within a Unit directory and namespace ^ Within a Unit directory and namespace
Called JobTest because it's testing the Job class Called JobTest because it's testing the Job class
Called testCreate because it's testing the create method Called testCreate because it's testing the create method
Create a job with the create method
Retrieve data from the object with getters
--- ---
@ -347,6 +379,8 @@ class JobTest extends UnitTestCase {
} }
``` ```
^ Create a job with the create method
--- ---
```php, [.highlight: 13-15] ```php, [.highlight: 13-15]
@ -370,6 +404,9 @@ class JobTest extends UnitTestCase {
} }
``` ```
^ Retrieve data from the object with getters
Asssert that the data is correct.
--- ---
[.header: #53B0EB] [.header: #53B0EB]
@ -424,6 +461,8 @@ protected function setUp() {
} }
``` ```
^ Steps that need to run before each test method
--- ---
```php, [.highlight: 6] ```php, [.highlight: 6]
@ -448,6 +487,8 @@ protected function setUp() {
} }
``` ```
^ Create the database tables
--- ---
```php, [.highlight: 8-16] ```php, [.highlight: 8-16]
@ -472,6 +513,8 @@ protected function setUp() {
} }
``` ```
^ Create and save a queue
--- ---
```php, [.highlight: 18] ```php, [.highlight: 18]
@ -496,6 +539,9 @@ protected function setUp() {
} }
``` ```
^ Because it's a kernel test, we have access to the container
to get the AdvancedQueue processor service.
--- ---
```php ```php
@ -524,6 +570,8 @@ public function testProcessor() {
} }
``` ```
^ Start by creating some jobs.
--- ---
```php, [.highlight: 6-10] ```php, [.highlight: 6-10]
@ -543,6 +591,8 @@ public function testProcessor() {
} }
``` ```
^ Add the jobs to the queue
--- ---
```php, [.highlight: 11-13] ```php, [.highlight: 11-13]
@ -562,6 +612,8 @@ public function testProcessor() {
} }
``` ```
^ Process the queue, and check the number of processed items.
--- ---
[.header: #53B0EB] [.header: #53B0EB]
@ -576,6 +628,8 @@ public function testProcessor() {
- With/without JavaScript - With/without JavaScript
^ testing profile ^ testing profile
Functional/FunctionalJavascript
Nightwatch
--- ---
@ -593,6 +647,8 @@ class QueueTest extends BrowserTestBase {
} }
``` ```
^ Extend BrowserTestBase
--- ---
```php, [.highlight: 6-8] ```php, [.highlight: 6-8]
@ -610,6 +666,9 @@ protected function setUp() {
} }
``` ```
^ We have the ability to place blocks
And create users with permissions and log them in
--- ---
```php, [.highlight: 10-11] ```php, [.highlight: 10-11]
@ -651,7 +710,6 @@ public function testQueueDeletion() {
``` ```
--- ---
```php, [.highlight: 12-14] ```php, [.highlight: 12-14]
// tests/src/Functional/QueueTest.php // tests/src/Functional/QueueTest.php
@ -673,6 +731,8 @@ public function testQueueDeletion() {
} }
``` ```
^ I prefer to use the route name and Url::fromRoute
--- ---
```php, [.highlight: 16-17] ```php, [.highlight: 16-17]
@ -1003,18 +1063,17 @@ $ php core/scripts/run-tests.sh --class ExampleTest
--- ---
``` ```
cd web vendor/bin/phpunit \
-c core \
../vendor/bin/phpunit -c core \
modules/contrib/examples/phpunit_example modules/contrib/examples/phpunit_example
``` ```
--- ---
``` ```
cd web/core cd core
../../vendor/bin/phpunit \ ../vendor/bin/phpunit \
../modules/contrib/examples/phpunit_example ../modules/contrib/examples/phpunit_example
``` ```
@ -1036,8 +1095,23 @@ cd web/core
--- ---
# _Docksal_
```
fin addon install phpunit
fin phpunit modules/custom
```
^ Copies a stub phpunit.xml file or copies phpunit.xml.dist
Runs the phpunit command within the correct directory
---
![fit](images/phpstorm-integration.png) ![fit](images/phpstorm-integration.png)
[.footer: opdavi.es/docksal-phpunit-phpstorm]
--- ---
[.header: alignment(center)] [.header: alignment(center)]