Behat Kickstart for Drupal Developers

Total Page:16

File Type:pdf, Size:1020Kb

Behat Kickstart for Drupal Developers BEHAT KICKSTART FOR DRUPAL DEVELOPERS Florida DrupalCamp 2016 Orlando, FL - March 5 - 6, 2016 Peter Sawczynec Engineer INTRO TO DRUPAL TESTING ECOSYSTEM Behat SimpleTest PHPUnit JMeter Drupal Extension Mink Selenium 2.0 Phantom.js Mockery Prophecy Codeception Wraith Casper.js Slimer.js Phantom.css Jenkins Travis CI Circle.ci CrossBrowserTesting.com Sauce Labs New Relic FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS INTRO TO DRUPAL/PHP TESTING ECOSYSTEM Consider using these tools in your Drupal development process: phpStorm drush composer drupal console FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS Behat INTRO TO BDD Behaviour Driven Development (BDD) FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS INTRO TO BEHAT Formal Explanation Behat is a tool that makes behavior driven development (BDD) possible. With BDD, you write human-readable stories that describe the behavior of your application. These stories can then be auto-tested against your application. FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS INTRO TO BEHAT Informal Explanation Behat is about the concept of using a simple coding language (Gherkin) with simple words to describe things that get done (behaviors) on your website that you want to test using an ecosystem of software libraries/tools. FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS Behat in Drupal BEHAT IN DRUPAL Behat usage in Drupal involves installing a set of software libraries that work quite seamlessly together FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS INSTALL WITH COMPOSER In Drupal 7 and 8 install and update Behat and all the additional libraries and components you need with Composer FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS STATE OF TESTING IN DRUPAL 8 ● Drupal 8 ships with a vendor directory that contains Behat ● Drupal 8 ships with PHPUnit ● SimpleTest module also ships in D8 core, but must be enabled FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS MINK, MINK EXTENSION, DRUPAL EXTENSION... ● Mink, Mink Extension, Drupal Extension, Selenium, Phantom.js ... ● Software libraries like the above are important adjuncts to Behat, these libraries create the bridge to your web pages and to Drupal so you can run tests on your site FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS Behat Ecosystem in Drupal DRUPAL BEHAT ECOSYSTEM Where your Behat 3.0 Behat tests get Mink written Headless Browsers Behat Feature files with steps, Browser the “Tests” Goutte Controllers Selenium2 Gherkin Behat Context Phantom.js PHP class files, the testing code PHP Website, Drupal Extension website pages (drupal and drush) Drupal EXECUTION CODE INTRO TO BDD The space where as a Drupal developer Where your you write Behat tests and supporting Behat tests get written code logic using Gherkin and PHP Behat Feature Behat Context files, class files, the “Tests” the testing code Gherkin PHP Drupal Writing Behat Testing for Drupal STEPS, SCENARIOS, BACKGROUND Comments and Annotations ● More useful and required in your code. ● Used by Drupal, Behat, Symfony and other frameworks to “discover” your code and what it does FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS STEPS, SCENARIOS, BACKGROUND Comments /** * Step function to visit the last created node of a specific type. and * Annotations * @param string $type * The type of node that should be visited. Examples: * * @Given I visit the last created :type node */ Comment /** * Views query plugin for an XML query. * Annotation * @ingroup views_query_plugins * (contains info for * @ViewsQuery( the framework) * id = "views_xml_backend", * title = @Translation("XML Query"), * help = @Translation("Query will be generated and run using the XML backend.") * ) */ FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS INTRO TO BDD Feature file # Groups: Event, search (Gherkin) Given I run drush "search-api-index" Then I login And I click "Events" Then I click "New Group Event" Behat Feature Then I should see the text "Looking for members?" Andfiles, I follow the link element with xpath "//a[contains(@href,'/group-ela')]" Giventhe “Tests” I visit the last created "article" node Context class file Gherkin /** * Step function to visit the last created node of a specific type. (PHP) * * @param string $type * The type of node that should be visited. * * @Given I visit the last created :type node Behat Context class files,*/ public function iVisitTheLastCreatedNodeByType($type) { the testing $node code = $this->getLastCreatedEntityFromDb('node', $type); $this->getSession()->visit($this->locatePath('/node/' . $node->nid)); PHP } Drupal INTRO TO BDD Feature file # Groups: Event, search Given I run drush "search-api-index" (Gherkin) Then I login And I click "Events" Then I click "New Group Event" Behat Feature Then I should see the text "Looking for members?" Andfiles, I follow the link element with xpath "//a[contains(@href,'/group-ela')]" Giventhe “Tests” I visit the last created "article" node Context class file Gherkin /** (PHP) * Step function to visit the last created node of a specific type. * * @param string $type * The type of node that should be visited. * * @Given I visit the last created :type node Behat Context class files,*/ public function iVisitTheLastCreatedNodeByType($type) { the testing $node code = $this->getLastCreatedEntityFromDb('node', $type); $this->getSession()->visit($this->locatePath('/node/' . $node->nid)); PHP } Drupal INTRO TO BDD Feature file (Gherkin) Then I login Then I should see the text "Looking for members?" Given I visit the last created "article" node Then Behat IFeature logout Context class file files, ...the “Tests” /** (PHP) * Step function to visit the last created node of a specific type. Gherkin * * @param string $type * The type of node that should be visited. * Behat * @Given Context I visit the last created :type node class files, the */testing code public function iVisitTheLastCreatedNodeByType($type) { PHP Drupal $node = $this->getLastCreatedEntityFromDb('node', $type); STEPS Steps in Gherkin When I am on the homepage Then I should get a "200" HTTP response And I should see the button 'Log in' When I go to "/admin" Then I should get a "403" HTTP response Steps And I should see "Access denied" FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS STEPS, TAGS, SCENARIO Steps in use in a Scenario: Tags @smoke @access Scenario: Anonymous User permissions When I am on the homepage Scenario Title Then I should get a "200" HTTP response And I should see the button 'Log in' When I go to "/admin" Then I should get a "403" HTTP response Steps And I should see "Access denied" FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS TAGGING @api @permissions Feature: Specific user permissions As an authenticated user Tags to identify the 1. I shouldPoint not be able to access One admin pages whole feature file So that I can verify my permissions 2. @smokePoint Two Scenario: Anonymous User permissions When I am on the homepage 3. Then IPoint should get a "200" Three HTTP response Tags by scenario 4. And I Pointshould see the button Four 'Log in' 5. Point Five FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS STEPS, TAGS, SCENARIO, SCENARIO OUTLINE, BACKGROUND @api @permissions @member @group @access @info Feature: Specific user permissions Scenario Outline: Access user info, login history As an authenticated user Given I am logged in as <user> with password <password> ISteps should not be able to access admin pages # View user login history So that I can verify my permissions And I visit the login history for <user_target> Then I should get a "<response>" HTTP response # Create standard users for all tests. Background: Examples: Given set content creation mode as "default" | user | user_target | response | password | And load the background users: | um1 | um11 | 404 | "xxx-xxx" | | user | | ug2 | um21 | 404 | "xxx-xxx" | | uorgmanager1 | | ug1 | um32 | 200 | "xxx-xxx" | | umember1b | | genl | "qam" | 200 | "xxx-xxx" | @smoke Scenario: Anonymous User permissions When I am on the homepage Then I should get a "200" HTTP response And I should see the button 'Log in' FLORIDA DRUPALCAMP 2016 | BEHAT KICKSTART FOR DRUPAL DEVELOPERS | PETER SAWCZYNEC | PETER.SAWCZYNEC@CIVICACTIONS TABLE NODE @api @permissions Feature: Specific user permissions As an authenticated user 1. I shouldPoint not be able to access One admin pages So that I can verify my permissions 2.# CreatePoint standard users forTwo all tests. Background: Table Node data Given set content creation mode as "default" Essentially how to pass 3. And loadPontPoint the background ThreeThree users: | user | an array to your Behat | uorgmanager1 | method in your context 4. | umember1bPoint | Four @smoke 5. Scenario:PointFourPoint Anonymous
Recommended publications
  • Behat Table of Contents
    behat #behat Table of Contents About 1 Chapter 1: Getting started with behat 2 Remarks 2 Examples 2 Functional testing as user stories 2 Beginning with Behat 2 Extending Behat with Mink 4 Testing JavaScript with Mink and Selenium 6 Setting up test data 7 Capturing emails 8 Installation or Setup 9 Credits 12 About You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: behat It is an unofficial and free behat ebook created for educational purposes. All the content is extracted from Stack Overflow Documentation, which is written by many hardworking individuals at Stack Overflow. It is neither affiliated with Stack Overflow nor official behat. The content is released under Creative Commons BY-SA, and the list of contributors to each chapter are provided in the credits section at the end of this book. Images may be copyright of their respective owners unless otherwise specified. All trademarks and registered trademarks are the property of their respective company owners. Use the content presented in this book at your own risk; it is not guaranteed to be correct nor accurate, please send your feedback and corrections to [email protected] https://riptutorial.com/ 1 Chapter 1: Getting started with behat Remarks This section provides an overview of what behat is, and why a developer might want to use it. It should also mention any large subjects within behat, and link out to the related topics. Since the Documentation for behat is new, you may need to create initial versions of those related topics.
    [Show full text]
  • Design Patterns in PHP and Laravel — Kelt Dockins Design Patterns in PHP and Laravel
    Design Patterns in PHP and Laravel — Kelt Dockins Design Patterns in PHP and Laravel Kelt Dockins [email protected] Design Patterns in PHP and Laravel Kelt Dockins Dolph, Arkansas USA ISBN-13 (pbk): 978-1-4842-2450-2 ISBN-13 (electronic): 978-1-4842-2451-9 DOI 10.1007/978-1-4842-2451-9 Library of Congress Control Number: 2016961807 Copyright © 2017 by Kelt Dockins This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made.
    [Show full text]
  • Prioritizing Pull Requests
    Prioritizing pull requests Version of June 17, 2015 Erik van der Veen Prioritizing pull requests THESIS submitted in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE in COMPUTER SCIENCE by Erik van der Veen born in Voorburg, the Netherlands Software Engineering Research Group Q42 Department of Software Technology Waldorpstraat 17F Faculty EEMCS, Delft University of Technology 2521 CA Delft, the Netherlands The Hague, the Netherlands www.ewi.tudelft.nl www.q42.com c 2014 Erik van der Veen. Cover picture: Finding the pull request that needs the most attention. Prioritizing pull requests Author: Erik van der Veen Student id: 1509381 Email: [email protected] Abstract Previous work showed that in the pull-based development model integrators face challenges with regard to prioritizing work in the face of multiple concurrent pull requests. We identified the manual prioritization heuristics applied by integrators and ex- tracted features from these heuristics. The features are used to train a machine learning model, which is capable of predicting a pull request’s importance. The importance is then used to create a prioritized order of the pull requests. Our main contribution is the design and initial implementation of a prototype service, called PRioritizer, which automatically prioritizes pull requests. The service works like a priority inbox for pull requests, recommending the top pull requests the project owner should focus on. It keeps the pull request list up-to-date when pull requests are merged or closed. In addition, the service provides functionality that GitHub is currently lacking. We implemented pairwise pull request conflict detection and several new filter and sorting options e.g.
    [Show full text]
  • Zašto Smo Odabrali Laravel (4)?
    Zašto smo odabrali Laravel (4)? Denis Stančer Prije framework-a • Razvijate web aplikacije od ranih početaka (kraj XX stoljeća) • Perl – CGI • PHP (3.0 - 6/1998, 4.0 - 5/2000, 5.0 - 7/2004, 5.3 - 6/2009 ) • Tijekom vremena sami razvijete elemente frameworka • Prednosti: • Brži razvoj • Neka vrsta standarda • Nedostaci: • Još uvijek velika količina spaghetti kôda • Pojedini developer ima svoj framework • Ne razvijaju se svi jednako brzo • Nama pravovremenih sigurnosnih zakrpi U Srcu • Koji PHP framework koristite ili ste koristili? Zašto framework? • Brži razvoj • Standardizirana organizacija kôda • Pojednostavljeno • Pristupu bazi/bazama • Zaštita od osnovnih sigurnosnih propusta • Modularnost • Razmjena gotovih rješenja među developerima • Copy/paste ili Composer • U MVC framework-u razdvojen HTML/JS od PHP-a • U konačnici - bolja suradnja unutar tima = efikasniji razvoj i održavanje MVC – Model-View-Controller • Programski predložak kojim se komunikacija s korisnikom dijeli na tri dijela: • data model: podaci • najčešće baza • user interface: prikaz stanja u modelu • najčešće templating engine • bussines model: šalje naredbe modelu Koji framework odabrati? • Koji su najpopularniji? • Koji imaju mogućnosti koje nama trebaju? • Popis općih kriterija • Composer • ORM • Testna okruženja • Migracije i seeding • Templating engine • Bootstrap • Git • Kvaliteta dokumentacije • Stanje zajednice: forumi, članci, konferencije,… Koji framework odabrati? (2) • Popis specifičnih kriterija • Mali (rijetko srednje veliki) projekti • simpleSAMLphp: jednostavno
    [Show full text]
  • Stable Enough to Be Used by Aprox 20 Companies to Manage Applications
    YAWIK Documentation Release 0.34.1 CROSS Solution Jun 25, 2020 Contents 1 About YAWIK 3 1.1 Important Links for developers.....................................4 2 Requirements 5 3 Preparations 7 3.1 Ubuntu 18.04...............................................7 3.2 Debian 10.................................................8 3.3 Install mongo Database.........................................8 4 Installation 9 4.1 Installation with composer........................................9 4.2 Install without composer......................................... 10 4.3 Install for Developers.......................................... 10 5 Runtime 13 5.1 Using Apache.............................................. 13 5.2 Using Nginx............................................... 14 5.3 Authentication.............................................. 15 5.4 Debugging................................................ 15 6 Upgrade 17 6.1 0.24 => 0.25............................................... 17 6.2 0.31 => 0.32............................................... 18 7 Configuration 19 7.1 Authentication.............................................. 19 7.2 Example: Setting up Facebook, Xing or LinkedIn Login........................ 20 7.3 Authentication.............................................. 20 7.4 Mail.................................................... 22 7.5 Jobs.................................................... 23 7.6 Sitename................................................. 25 7.7 Apache.................................................. 25 7.8 MongoDB...............................................
    [Show full text]
  • WEB DEVELOPER » Portfolio » Github SUMMARY I’M a Full-Stack Developer and a Programming Instructor
    LUIS MONTEALEGRE - WEB DEVELOPER » Portfolio » Github SUMMARY I’m a full-stack developer and a programming instructor. I want to be surrounded by people who push me to do the best work of my career as well as people I can nurture and support. I have over 13 years of experience in tech both in Mexico and the United States and I’m looking forward to be part of a team that values work-life balance, TDD, pair programming and code reviews. PROGRAMMING LANGUAGES AND TOOLS PHP 11 years • Laravel, Zend Framework 1, Symfony 1 & 2, Slim 2, Silex, Doctrine 1 & 2, PHPUnit, Behat, phpspec, Codeception • MySQL, PostgreSQL • jQuery, Jasmine, RequireJS, Bower, npm, Webpack, ES6, PhantomJS • Bootstrap, Sass • Vagrant, Docker • Git, SVN C# 4 years • ASP.NET Web Forms, Visual Basic • jQuery, JQuery UI • SQL Server, Oracle PL/SQL • TFS Java 2 years • Spring Boot, JUnit, Hibernate, DBUnit, Servlets, JSP/JSTL, Swing • Maven • MySQL, PostgreSQL CERTIFICATIONS EDUCATION Latinux Certified Linux Operator B. S. and Master in Computer Science. Oracle Certified Java Programmer Emeritus Autonomous University of Puebla. MCTS Microsoft SQL Server & Web [1998-2003, 2003-2005] Applications OPEN SOURCE CONTRIBUTIONS AND COMMUNITY WORK My contributions to open source projects include: Drupal Console, Codeception, Eris and Couscous. I also maintain some libraries: Modules System for Slim 2, Doctrine DBAL Fixtures Generator and a Yelp Fusion API Java Client. I'm the founder an former organizer of the PHP Puebla User Group. I helped organizing dozens of workshops and technical talks. I'm currently particpating with the San Antonio Coding Challenge meetup.
    [Show full text]
  • Bdd, Functional Tests & Selenium (In Drupal!)
    Behat BDD, FUNCTIONAL TESTS & SELENIUM (IN DRUPAL!) ♥’s Hallo! > Lead of the Symfony documentation team > KnpLabs US - Symfony consulting, training & kumbaya > Writer for KnpUniversity.com: PHP & Symfony screencasts packed with puns, unrelated (but entertaining) illustrations and coding challenges! > Husband of the much more talented @leannapelham knpuniversity.com twitter.com/weaverryan Plan, Work, Miscommunicate, Panic, Put out Fires, Repeat! aka Project Work! How the customer explained it http://www.projectcartoon.com How the project leader understood it http://www.projectcartoon.com How the programmer wrote it http://www.projectcartoon.com What the customer really needed http://www.projectcartoon.com What the beta testers received http://www.projectcartoon.com Computer Science? https://www.flickr.com/photos/diueine/3604050776 One Different roles, different languages, miscommunication @weaverryan Tw o Your code and business values may not align @weaverryan I've just dreamt up this cool new feature that we should implement! Why? Because it's cool! Three Over-planning, under-planning, planning...? @weaverryan Getting down with BDD https://www.flickr.com/photos/tambako/4175456498 Evolution of Test-Driven Development @weaverryan “Behaviour” is a more useful word, than “test” - Dan North * * the santa of behavior-driven development Evolution of Test-Driven Development ≈ Unit Tests ≈ Functional Tests @weaverryan Specification BDD http://www.phpspec.net @weaverryan Scenario-oriented BDD (Story BDD) Let’s create a single vocabulary and process
    [Show full text]
  • Full Stack Developer London £525/Day Years of Experience: 10+ Latest Contract: Javascript / PHP Developer at a Top National Organisation
    Full Stack Developer London £525/day Years of experience: 10+ Latest contract: JavaScript / PHP Developer at a Top National Organisation. Professional Profile: • Full stack developer, JavaScript Developer, MEAN Stack Developer, LAMP Stack Developer • Solid, commercial, hands-on experience and in-depth knowledge of various web technologies with focus on the LAMP and MEAN stack (JavaScript). • Service Oriented Architecture, REST API, solid OOP, CMS, CRM systems, design patterns, Test Driven Development (TDD), BDD, Agile, Scrum, Kanban, Continues Integration • PHP: 10 years of experience in PHP, Zend Framework (ZF1, ZF2), Doctrine2 (ORM), PHPUnit (TDD), Behat (BDD), Mink (Selenium) • Javascript: MEAN (MongoDB, Express, Angular, Node.js), Task runners (Grunt, Gulp), Bower, RequireJS, TDD & BDD (jasmine, karma, protractor) • DB: MySQL (Percona, MariaDB), MSSQL, MongoDB, ElasticSearch • Frontend: HTML5, CSS3, AngularJS, vanilla JavaScript, jQuery, Twitter Bootstrap, LESS, SASS • Misc: Amazon Web Services (AWS), git, git-flow, github, vagrant, docker, Jenkins, CI, CD • Experience in working in Agile environments. Strong experience in technical, business/system analysis and system design. Strong problem solving. Solid understanding of the full development life cycle Creation Recruitment | 01179 298 243 | www.creationrecruitment.co.uk Relevant Experience: Top National Organisation – Contract Javascript/PHP Developer November 2015 – present Greenfield MVP Case Management for 4000 local orgaisation offices. Techstack and environment: • Env: docker,
    [Show full text]
  • Back End PHP and Javascript Developer London £425/Day Years of Experience: 15+ Latest Contract: Senior Developer, Communications Agency
    Back End PHP and JavaScript Developer London £425/day Years of experience: 15+ Latest contract: Senior Developer, Communications Agency I have been working on web applications since 2000, and have been using PHP and MySQL continuously since 2004. I am expert in object-oriented programming, and have built my own system architectures and Frameworks. I have also worked extensively with packaged frameworks including Symfony 2, Zend Framework 1 and CodeIgniter. I am SC cleared for Government work as oF April 2015. Main Skills (expert): PHP, LAMP, SymFony 2, Behat, PHPUnit, PHPSpec, Zend, CodeIgniter, MySql, Apache, Subversion, Git, Javascript, Jquery, Ajax, HTML, CSS, Ruby, HAML, Cucumber Secondary skills (experience limited or some years ago): Rails, Sinatra, Wordpress, Concrete 5, Python, Perl, Java, Linux Administration, Nginx, Moodle, AngularJS Contracts History August 2015 – Present Senior Web developer Comunications Agency I worked on a corporate course administration system based on Moodle. I developed new plugins For administering users, wrote new code For importing users and generated management inFormation reports. I wrote unit tested code whenever practical. PHP5, Moodle, PhpUnit, MySQL, Solr May 2003 – present System Architect/Applications Developer Government Body An interactive site developed by a journalist and a sociologist, which promotes a model of political typology. I took over as programmer of the site in 2003, and entirely re-wrote it in object-oriented PHP (it was originally in Perl). I improved the framework to make it maintainable and more eFFicient. I developed a new product in Flash (a certiFicate which users can order online, pay For by credit card and load in the browser).
    [Show full text]
  • Alexander M. Turek
    Painfl Migration Paths Alexander M. Turek [AMT] 1 Alexander M. Turek about:me Freelance software developer. Builds web applications with php. Lives in Frankfurt München Berlin. Likes Symfony. Likes digging into legacy code. [AMT] 2 Alexander M. Turek Disclaimer This session is not about bashing the developers of the libraries shown in the examples. I have a lot of respect for open source developers who spend a large part of their free time on improving and maintaining those awesome libraries. [AMT] 3 Alexander M. Turek Framework Migration • Your framework evolves while you're using it. • Follow the upstream development or lose support. • Outdated dependencies might block upgrade paths of other dependencies. [AMT] 4 Alexander M. Turek PHP / Composer Limitations • PHP has no concept of loading different versions of a library at the same time. • Composer does not allow to install multiple versions of the same package at the same time. [AMT] 5 Alexander M. Turek How do you refactor code? [AMT] 6 Alexander M. Turek My Recent Painfl Migrations • Guzzle 3 —> Guzzle 6 • Silex 1 —> Silex 2 • Behat 2 —> Behat 3 [AMT] 7 Alexander M. Turek Guzzle • HTTP client library. • Guzzle 4 was a complete rewrite. • All code that used the same guzzle client instance had to be migrated at once. • Good: Guzzle switched namespace/package name. • Bad: Guzzle 3 blocks Symfony upgrades. [AMT] 8 Alexander M. Turek Silex • Symfony-based micro framework. • Tightly coupled to the Pimple DIC. • Silex 1 blocks Symfony upgrades. • All-or-nothing migration. [AMT] 9 Alexander M. Turek Tight coupling via inheritance namespace Silex; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\TerminableInterface; class Application extends \Pimple implements HttpKernelInterface, TerminableInterface [AMT] 10 Alexander M.
    [Show full text]
  • The Drupal Extension to Behat and Mink Documentation Release 1.1
    the Drupal Extension to Behat and Mink Documentation Release 1.1 Melissa Anderson Nov 22, 2019 Contents 1 Testing your site with the Drupal Extension to Behat and Mink3 2 System Requirements 5 3 Stand-alone installation 7 4 System-wide installation 11 5 Environment specific settings 15 6 Drupal Extension Drivers 17 7 Blackbox Driver 19 8 Drush Driver 23 9 Drupal API Driver 27 10 Contexts 31 11 Contributed Module Subcontexts 35 i ii the Drupal Extension to Behat and Mink Documentation, Release 1.1 Contents: Contents 1 the Drupal Extension to Behat and Mink Documentation, Release 1.1 2 Contents CHAPTER 1 Testing your site with the Drupal Extension to Behat and Mink The Drupal Extension to Behat and Mink provides Drupal-specific functionality for the Behavior-Driven Development testing frameworks of Behat and Mink. 1.1 What do Behat and Mink Do? Behat and Mink allow you to describe the behavior of a web site in plain, but stylized language, and then turn that description into an automated test that will visit the site and perform each step you describe. Such functional tests can help site builders ensure that the added value they’ve created when building a Drupal site continues to behave as expected after any sort of site change – security updates, new module versions, changes to custom code, etc. 1.2 What does the Drupal Extension add? The Drupal Extension to Behat and Mink assists in the performance of these common Drupal testing tasks: • Set up test data with Drush or the Drupal API • Define theme regions and test data appears within them • Clear the cache, log out, and other useful steps • Detect and discover steps provided by contributed modules and themes 3 the Drupal Extension to Behat and Mink Documentation, Release 1.1 4 Chapter 1.
    [Show full text]
  • Test Automation and Pipelines One Step at a Time
    Test automation and pipelines one step at a time Antonis Pavlakis @pavlakis Code Unit Tests Possible steps required ● composer install (local environment) ● bin/phpunit -c tests/phpunit/phpunit.xml Unit Tests Possible steps required ● Download composer (CI environment) ● composer install ● bin/phpunit -c tests/phpunit/phpunit.xml Bitbucket Pipelines Pipeline status Cache performance Using a custom Docker image Dockerfile Build Docker image docker build -t docker push phpminds/php:7.2.15 . phpminds/php:7.2.15 Pipeline with custom image Pipeline performance Integration Tests Possible steps required ● composer install (local environment) ● composer reset-db ● composer populate-db ● bin/phpunit -c tests/phpunit/phpunit.xml --group integration Set DB to a known "scripts": { state "reset-db": [ "bin/console doctrine:database:drop --force", "bin/console doctrine:database:create", "bin/console doctrine:schema:update --force" Using composer scripts ], "populate-db": [ "bin/console doctrine:fixtures:load" ] } Docker Compose Update Docker Update Docker image image ● Add mysql client Run integration tests using Docker Compose If docker compose is not already running: docker-compose up --build -d Run tests from inside the running container: docker-compose exec -T phpminds-php sh -c "bin/phpunit -c tests/phpunit/phpunit.xml --group integration" Docker Compose in Steps required ● Install Docker Compose Bitbucket Pipelines ● docker-compose up --build -d ● composer install ● (wait for DB container to start) ● composer reset-db ● composer populate-db ● bin/phpunit -c tests/phpunit/phpunit.xml --group integration Install Docker Compose Check DB connection Putting it all together A build with Docker Compose Environment Variables Using .env ci/assets/env.ci Using .env Managing secrets Using repository variables Acceptance Tests Possible steps required ● composer install ● composer reset-db ● composer populate-db ● bin/behat -c tests/behat/behat.yml Example behat.yml Add pipeline step Thank You Antonis Pavlakis @pavlakis.
    [Show full text]