Update and export slides
This commit is contained in:
parent
242410f8c0
commit
fa9e60e6cd
Binary file not shown.
|
@ -1,7 +1,7 @@
|
|||
autoscale: true
|
||||
build-lists: true
|
||||
footer-style: alignment(left)
|
||||
footer: @opdavies | oliverdavi.es
|
||||
footer: @opdavies | opdavi.es
|
||||
header-emphasis: #53B0EB
|
||||
header: alignment(left)
|
||||
text: alignment(left)
|
||||
|
@ -21,17 +21,16 @@ theme: poster, 8
|
|||
[.header: #111111]
|
||||
[.text: #111111, alignment(left)]
|
||||
|
||||
![right 700%](../../me-phpnw.png)
|
||||
![right 700%](../images/me-phpnw.png)
|
||||
|
||||
- Full stack Web Developer & System Administrator
|
||||
- Senior Developer at Microserve
|
||||
- Part-time freelancer
|
||||
- Acquia certified Drupal 8 Grand Master
|
||||
- Drupal 7 & 8 core contributor
|
||||
- Drupal core contributor
|
||||
- Open source project maintainer
|
||||
- Drupal Bristol and PHPSW co-organiser
|
||||
- opdavies (Drupal.org, GitHub, Twitter)
|
||||
- www.oliverdavi.es
|
||||
- www.oliverdavies.uk
|
||||
|
||||
^ Work at Microserve.
|
||||
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_
|
||||
## 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_
|
||||
## Drupal.org API
|
||||
|
||||
^ The first thing I built was...
|
||||
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
|
||||
$ 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_
|
||||
## Drupalversary?
|
||||
|
||||
|
@ -130,10 +186,16 @@ Demo
|
|||
|
||||
---
|
||||
|
||||
- oliverdavi.es/_talks_
|
||||
- oliverdavi.es/_youtube_
|
||||
- oliverdavi.es/_github_
|
||||
- oliverdavi.es/_packagist_
|
||||
[.hide-footer]
|
||||
|
||||
![fit](images/drupalversary.png)
|
||||
|
||||
---
|
||||
|
||||
- opdavi.es/_talks_
|
||||
- opdavi.es/_do-library_
|
||||
- opdavi.es/_drupalversary_
|
||||
- opdavi.es/_do-projects_
|
||||
|
||||
---
|
||||
|
||||
|
@ -146,4 +208,3 @@ Demo
|
|||
[.header: alignment(center)]
|
||||
|
||||
# Thanks
|
||||
### joind.in/_24044_
|
||||
|
|
BIN
tdd-test-driven-drupal/2019-03-02-drupalcamp-london/slides.pdf
Normal file
BIN
tdd-test-driven-drupal/2019-03-02-drupalcamp-london/slides.pdf
Normal file
Binary file not shown.
|
@ -53,7 +53,7 @@ code: Monaco, #6699FF, #999999, #6666FF, #66FF66, #66FF66, line-height(1.3)
|
|||
- Part-time freelancer
|
||||
- Acquia certified Drupal 8 Grand Master
|
||||
- Drupal 7 & 8 core contributor
|
||||
- Symfony, Laravel, ~~Silex,~~ Sculpin
|
||||
- Drupal, Symfony, Laravel, Sculpin
|
||||
- @opdavies
|
||||
- www.oliverdavies.uk
|
||||
|
||||
|
@ -91,6 +91,13 @@ Blog on my website
|
|||
|
||||
## test_driven_drupal_.com_
|
||||
|
||||
^ Book on automated testing in Drupal 8
|
||||
Building a conference website
|
||||
|
||||
---
|
||||
|
||||
![80%](images/tdd-drupal-tasks.png)
|
||||
|
||||
---
|
||||
|
||||
[.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 _30,572 sites_ in March 2019 (_10_ D5, _1,180_ D6, _24,057_ D7, _5,335_ D8)
|
||||
- _#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
|
||||
|
||||
---
|
||||
|
@ -159,7 +166,13 @@ ONO merge conflict
|
|||
- 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.
|
||||
|
||||
[.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]
|
||||
|
||||
## Writing Tests (Drupal 8)
|
||||
|
@ -181,7 +198,6 @@ ONO merge conflict
|
|||
- Class name must match the filename
|
||||
- Namespace must match the directory structure
|
||||
- One test class per feature
|
||||
- Each method must start with _test_
|
||||
|
||||
^ Different to D7
|
||||
|
||||
|
@ -195,6 +211,13 @@ ONO merge conflict
|
|||
|
||||
---
|
||||
|
||||
[.header: alignment(center)]
|
||||
|
||||
## _3._ Assert
|
||||
## _2._ Act
|
||||
## _1._ Arrange
|
||||
|
||||
---
|
||||
|
||||
```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]
|
||||
|
||||
## What to test?
|
||||
|
@ -321,8 +355,6 @@ class JobTest extends UnitTestCase {
|
|||
^ Within a Unit directory and namespace
|
||||
Called JobTest because it's testing the Job class
|
||||
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]
|
||||
|
@ -370,6 +404,9 @@ class JobTest extends UnitTestCase {
|
|||
}
|
||||
```
|
||||
|
||||
^ Retrieve data from the object with getters
|
||||
Asssert that the data is correct.
|
||||
|
||||
---
|
||||
|
||||
[.header: #53B0EB]
|
||||
|
@ -424,6 +461,8 @@ protected function setUp() {
|
|||
}
|
||||
```
|
||||
|
||||
^ Steps that need to run before each test method
|
||||
|
||||
---
|
||||
|
||||
```php, [.highlight: 6]
|
||||
|
@ -448,6 +487,8 @@ protected function setUp() {
|
|||
}
|
||||
```
|
||||
|
||||
^ Create the database tables
|
||||
|
||||
---
|
||||
|
||||
```php, [.highlight: 8-16]
|
||||
|
@ -472,6 +513,8 @@ protected function setUp() {
|
|||
}
|
||||
```
|
||||
|
||||
^ Create and save a queue
|
||||
|
||||
---
|
||||
|
||||
```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
|
||||
|
@ -524,6 +570,8 @@ public function testProcessor() {
|
|||
}
|
||||
```
|
||||
|
||||
^ Start by creating some jobs.
|
||||
|
||||
---
|
||||
|
||||
```php, [.highlight: 6-10]
|
||||
|
@ -543,6 +591,8 @@ public function testProcessor() {
|
|||
}
|
||||
```
|
||||
|
||||
^ Add the jobs to the queue
|
||||
|
||||
---
|
||||
|
||||
```php, [.highlight: 11-13]
|
||||
|
@ -562,6 +612,8 @@ public function testProcessor() {
|
|||
}
|
||||
```
|
||||
|
||||
^ Process the queue, and check the number of processed items.
|
||||
|
||||
---
|
||||
|
||||
[.header: #53B0EB]
|
||||
|
@ -576,6 +628,8 @@ public function testProcessor() {
|
|||
- With/without JavaScript
|
||||
|
||||
^ testing profile
|
||||
Functional/FunctionalJavascript
|
||||
Nightwatch
|
||||
|
||||
---
|
||||
|
||||
|
@ -593,6 +647,8 @@ class QueueTest extends BrowserTestBase {
|
|||
}
|
||||
```
|
||||
|
||||
^ Extend BrowserTestBase
|
||||
|
||||
---
|
||||
|
||||
```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]
|
||||
|
@ -651,7 +710,6 @@ public function testQueueDeletion() {
|
|||
```
|
||||
|
||||
---
|
||||
|
||||
```php, [.highlight: 12-14]
|
||||
// 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]
|
||||
|
@ -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
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
```
|
||||
cd web/core
|
||||
cd core
|
||||
|
||||
../../vendor/bin/phpunit \
|
||||
../vendor/bin/phpunit \
|
||||
../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)
|
||||
|
||||
[.footer: opdavi.es/docksal-phpunit-phpstorm]
|
||||
|
||||
---
|
||||
|
||||
[.header: alignment(center)]
|
||||
|
|
Loading…
Reference in a new issue