Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internals - Set up standardized environment for testing and development #13578

Closed
6 tasks done
niden opened this issue Nov 3, 2018 · 13 comments
Closed
6 tasks done

Internals - Set up standardized environment for testing and development #13578

niden opened this issue Nov 3, 2018 · 13 comments
Assignees
Labels
enhancement Enhancement to the framework testing Tests related issue wip Work In Progress
Milestone

Comments

@niden
Copy link
Sponsor Member

niden commented Nov 3, 2018

There is a need for a standardized environment to be used for testing and/or development

Requirements

  • Easy to setup
  • Offer all the necessary services for the framework
  • Ability to run the testing suite locally

Implementation

  • The use of docker and nanobox.io satisfies the above needs
  • Installation for various platforms
  • Containers offer the necessary services for the application
  • Can compile Phalcon and run suite

Status

  • Set up environment with the boxfile.yml
  • Add all the necessary services and related extensions (Redis, Postgresql etc.)
  • Rebuild the test suite to cover as many methods as possible (for now)
  • Create Integration test suite
  • Create Cli test suite
  • Create Unit test suite

Working Branch

https://github.com/niden/cphalcon/tree/T13578-setup-phalcon-environment

Coding standard

  • We are using the Cest format of Codeception.
  • Each test file represents a method of a component.
  • Tests are written for each method accordingly.
  • Keep each test file as small as possible to improve readability
  • Keep each test with as few assertions as possible and as few steps as possible. It makes it easier to read
  • Docblocks on each test are required
  • The name of each test is the namespace and method and then the purpose. For instance

Phalcon\Acl\Adapter\Memory :: allow() has a test of aclAdapterMemoryAllow.

  • Each test must have a call to $I->wantToTest() describing what is being tested. This helps with reading the output and identifying where an error has happened. The message contains the namespace/component and the method (see also docblock). For instance

$I->wantToTest('Acl\Adapter\Memory - allow() - try to allow twice');

@niden niden added enhancement Enhancement to the framework testing Tests related issue wip Work In Progress labels Nov 3, 2018
@niden niden self-assigned this Nov 3, 2018
@niden niden added this to the 4.0.0 milestone Nov 3, 2018
@dschissler

This comment was marked as abuse.

@niden
Copy link
Sponsor Member Author

niden commented Nov 4, 2018

@dschissler Agreed. The environment should allow you to use any Zephir version from the relevant repo and compile Phalcon as needed.

@dschissler

This comment was marked as abuse.

@dschissler

This comment was marked as abuse.

@dschissler

This comment was marked as abuse.

@niden
Copy link
Sponsor Member Author

niden commented Nov 6, 2018

@dschissler Valid points.

The issue is not to get more people to use nanobox. We don't own stock there or anything like that. It has been however used for over a year now and it has worked as advertised. There is no need to know docker or anything like that. All you do is run a command.

The goal of this issue is to create quickly an environment so that people can develop in Zephir for Phalcon and be able to run the test suite without having to install a bunch of prerequisites.

The reason we are leaning towards nanobox is that there are no complex scripts or anything like that to provision the environment.

Your approach takes into account the environment (ubuntu, fedora etc.) which nanobox does not. That could very well be something we might want to check a bit later.

For now, the goal is to create this environment and to do so a lot of the tests have to be rewritten and organized so this is the focus for now.

@danhunsaker
Copy link

danhunsaker commented Nov 6, 2018

@dschissler I'm a former Nanobox employee, so I expect my input will be ignored or at least glossed over, but the fact it uses Docker under the hood doesn't at all mean it requires knowledge thereof. I'm not sure which aspects of Nanobox you investigated, but the version of the product being used, here, is a single config file that sets up the entire dev environment, no knowledge of the build system itself required, nor the stack it runs within. Since Docker is readily available on any Linux OS, and can be installed on macOS and Windows, and Nanobox itself will happily install VirtualBox and configure its own Docker VM (the same way macOS and Windows are supported by Docker's so-called "Native" versions) if you like, it bypasses most or all of the OS-specific issues folks face. Maybe you saw some early documentation on the Dockerfile approach which still hasn't been released?

At any rate. This approach requires users to install Nanobox, then run the nanobox run command, to ensure a full working dev environment which won't interfere or otherwise directly interact with other environments on the host. Your approach, while solid and tested, seems to install dependencies directly onto the host, so it misses those advantages.

That said, alternative approaches could be used. Some have been considered internally, and at the moment Nanobox has won out. It might be helpful to increase the transparency around this decision, here?

I'm not technically part of the Phalcon team (I'm assigned to Zephir at the moment), but I'm more than willing to provide what insight I have, as desired.

@dschissler

This comment was marked as abuse.

@danhunsaker
Copy link

For my part, if you're willing to maintain those scripts, we can easily list the link to them in the README, for those who want an alternative approach.

@dschissler

This comment was marked as abuse.

@dschissler

This comment was marked as abuse.

@niden niden added this to In progress in 4.0.0 Release Nov 28, 2018
niden added a commit that referenced this issue Dec 5, 2018
* Moved tests to temp folder; Added initial boxfile with services

* Codeception bootstrap

* Escaper tests

* WIP - Modifying tests

* [#13578] - Updated docblocks, started work for Config

* [#13578] - Adjusted docblocks

* [#13578] - Added copyright notice; Refactored Config tests

* [#13578] - Refactored Debug/Dump tests

* [#13578] - Work on Messages

* [#13578] - Refactored Filter tests

* [#13578] - Moved back _ci folder

* [#13578] - Refactored Security tests

* [#13578] - PHPCS fixes

* [#13578] - Refactored validation messages

* [#13578] - PHPCS fixes

* [#13578] - Refactored Text tests

* [#13578] - WIP Tag test refactoring

* [#13578] - Refactored Tag

* [#13578] - Corrected tests; Added iconv in the boxfile

* [#13578] - Minor refactor in assets; Added Asset Filter tests

* [#13578] - Added necessary extensions in boxfile. Prepared some tests for refactoring; Work on image/assets

* [#13578] - PHPCS fixes

* [#13578] - Test corrections

* [#13578] - Assets refactoring; DiTrait to setup services; Refactoring on old tests

* [#13578] - Added fixtures in the autoloader

* [#13578] - Refactored Acl tests

* [#13578] - Test corrections

* [#13578] - Refactored Forms

* [#13578] - WIP - Http\Response Request

* [#13578] - Refactored Response tests

* [#13578] - Corrected Http tests; Refactored fixtures

* [#13578] - Enabled acpu extension; Refactored annotation tests

* [#13578] - PHPCS fixes

* [#13578] - Refactored Logger tests

* [#13578] - Refactored Flash tests

* [#13578] - Refactoring Loader tests

* [#13578] - Added zephir in composer for dev - will be reworked later on

* [#13578] - Moved old changelogs to the resources folder

* [#13578] - Changes to the boxfile to clean up folders

* [#13578] - Work on the dialects and fixtures; Refactored Version tests

* [#13578] - Refactored Text tests

* [#13578] - Added test stubs for every method and component of Phalcon; WIP to add relevant tests

* [#13578] - WIP: Message tests

* [#13578] - Added zephir dev as a requirement

* [#13578] - Minor correction to the test

* [#13578] - Refactored Messages\Message tests

* [#13578] - Refactored Messages tests

* [#13578] - Moved wip folder outside the test structure for the tests

* [#13578] - Work on the Tag tests; Refactored helpers for Tag

* [#13578] - PHPCS fixes and removed Exception test stubs

* [#13578] - Refactoring Tag tests

* [#13578] - Refactoring on Translation tests

* [#13578] - More tests added

* [#13578] - Added Image/factory; Removed Exception test stubs

* Removed unused variables

* WIP - Assets

* Refactoring asset inline js

* Moved a lot of tests from the wip/toCheck folders in the main folder. More work needed to refactor all of them

* Acl Role/Resource tests; Corrected names for constructor tests

* Added Registry tests

* Work on the dialect tests

* WIP - Db Dialect tests

* [#13578] - Work on skipped tests and extensionLoaded in the unit tester

* [#13578] - Renamed underscored files for PHPCS

* [#13578] - Rename of files with underscore in their names

* [#13578] - Renaming files; Work on Loader/Factory; Work on Cache

* [#13578] - Reformatting tests (cosmetic); Work on factory tests and backend cache

* [#13578] - Moved test stubs in unit

* [#13578] - Skipped a test (will check later)

* [#13578] - Initial structure for integration tests; Work on Assets

* [#13578] - Validation/Validator tests

* [#13578] - Renamed tests to give better output on console

* [#13578] - Test renaming for clarity; Work on validator tests

* [#13578] - Added descriptions for tests for better printout and information

* [#13578] - Added descriptions for Version tests

* [#13578] - Adding descriptions for tests

* [#13578] - Minor refactor of the validation tests

* [#13578] - Added comments and output for Text and Tag

* [#13578] - Added CLI suite and stubs

* [#13578] - Enabled unit helper in integration; Moved Db stubs in integration suite

* [#13578] - Work on Version

* [#13578] - Comments for all tests; Renamed tests according to namespaces; Added MemorySession for Codeception/Phalcon

* [#13578] - Corrected method names

* [#13578] - Corrected docblocks and messages

* [#13578] - Added more tests for __toString

* [#13578] - Added crypt trait to check for openssl

* [#13578] - Restored file I deleted by mistake

* [#13578] - Refactored Escaper tests

* [#13578] - Copyright notices

* [#13578] - Added db client libraries in the container

* [#13578] - Work on db tests; Added more packages to the boxfile

* [#13578] - Added more integration tests; moved fixtures around

* [#13578] - Events tests

* [#13578] - Added cache and di tests

* [#13578] - Added more tests from the toCheck

* [#13578] - Removed tests from deprecated projects

* [#13578] - Removed not needed files; Added pgsql import for nanobox; Added forms test

* [#13578] - More DB tests from "unit-tests"

* [#13578] - phpcs fixes and optimizations

* [#13578] - Added xcache in nanobox; Moved cache tests from unit-tests

* [#13578] - More tests moved (db from unit-tests)

* [#13578] - Moved dbdescribe tests from unit-tests

* [#13578] - Refactored Micro and Router tests; Reorganized assets

* [#13578] - Mvc Url and router tests

* [#13578] - Changed "boolean" to "bool" to ensure consistency

* [#13578] - Reorganized fixtures for views

* [#13578] - Work on the tests; skipped some to check later

* [#13578] - Added gitkeep to keep the cache folder there in the tests

* [#13578] - Fixed imports for the dbs for travis

* [#13578] - PHPCS fixes

* [#13578] - DbProfiler unit-test tests

* [#13578] - Work on models

* [#13578] - Added some debugging code

* [#13578] - Force disable travis cache for composer

* [#13578] - Removed zephir from composer; Started using the phar file in travis and nanobox

* [#13578] - Zephir version 11.6 in travis and boxfile

* [#13578] - Test correction

* [#13578] - Fixed test path

* [#13578] - More corrections to the test

* [#13578] - Added namespaces to models

* [#13578] - Work on the CI and db import scripts

* [#13578] - Corrections to the tests

* [#13578] - Added skips for this test

* [#13578] - Corrected models namespace

* [#13578] - Corrected some interfaces and implementations

* [#13578] - Removed php 7.0/7.1

* [#13578] - Beanstalk tests

* [#13578] - Fixing interfaces

* [#13578] - Removed APC, Memcache and XCache adapters (deprecated)

* [#13578] - Updated changelog

* [#13578] - Added di setup for view simple

* [#13578] - Fixing array access

* [#13578] - Simple view tests

* [#13578] - Fixed compilation errors

* [#13578] - Interface changes

* [#13578] - Trying compiling without the return type

* [#13578] - Interface corrections

* [#13578] - Fixing more interfaces

* [#13578] - Trying to use the NTS version

* [#13578] - Removed the lines I added before

* [#13578] - Fixed interfaces and compilation errors

* [#13578] - Changes to travis to reinstall php

* [#13578] - Triggering another build to install php again

* [#13578] - More interface changes

* [#13578] - Added dots....

* [#13578] - Interface corrections

* [#13578] - Removed unecessary tests

* [#13578] - More interface corrections

* [#13578] - One more correction to the interfaces

* [#13578] - More interface corrections

* [#13578] - Restored the folder I deleted by mistake (duh)

* [#13578] - Fixed interfaces for messages

* [#13578] - Corrected interface error

* [#13578] - Added missing class

* [#13578] - More interface corrections

* [#13578] - Corrected interface for the session test class

* [#13578] - Work on the environment variables and codeception

* [#13578] - Moved in the new suite the volt syntax tests; Adjustments to the travis for variables

* [#13578] - Fixing the environment for Travis

* [#13578] - Removed unecessary copy line

* [#13578] - Converted more Router tests

* [#13578] - Adjustment to Travis; Added more fixtures

* [#13578] - Work in volt compiler tests; reorganized delete strategy

* [#13578] - Skipping some tests to check travis

* [#13578] - Work on namespaces and env variables (again)

* [#13578] - Added boxfiles for 7.2/3, refacored the env and added env in integration tests

* [#13578] - Removed unwanted files; Refactoring of constants and env variables

* [#13578] - Added dispatcher tests

* [#13578] - Minor corrections

* [#13578] - Removing db from the bootstap

* [#13578] - Setup for CLI tasks

* [#13578] - Fixed environment file

* [#13578] - Work in models

* [#13578] - Db\Column tests; work on fixtures/models

* [#13578] - Fixing travis sqlite db

* [#13578] - Corrected setup db file

* [#13578] - Merge from 4.0; Zephir 11.8; Adjusted tests

* [#13578] - Added cache folder back

* [#13578] - Corrected tests

* [#13578] - Correcting interface

* [#13578] - Changed the cache backend "get" lifetime to only accept numbers

* [#13578] - Updated the changelog for the cache backend "get" lifetime

* [#13578] - Moved Micro test stubs in integration; Added micro collection test

* [#13578] - Corrected the interface

* [#13578] - Aligned cache interfaces

* [#13578] - Corrected controllers in micro collection

* [#13578] - Reverting changes to cache "get" interfaces

* [#13578] - Trying xenial for travis

* [#13578] - More interface corrections

* [#13578] - Added mysql service in travis

* [#13578] - Mysql 5.7 in travis

* [#13578] - Corrections to tests and php settings

* [#13578] - Corrected Volt test; Disabled run for integration for now

* [#13578] - Minor adjustment to the annotations tests

* [#13578] - Change to the reader cest for annotations

* [#13578] - More debug output

* [#13578] - Changes to the environment variables

* [#13578] - Marking some tests skipped to check them later

* [#13578] - Moved Forms tests in integration; Refactored all the old "unit-test" tests

* [#13578] - Moved pagination tests to the integration suite

* [#13578] - Code quality cleanup

* [#13578] - Moved Validation to integration suite; Added paginator tests

* [#13578] - Refactored a lot of MVC tests

* [#13578] - Refactored Session tests

* [#13578] - Corrections to Tag tests; Reenabled CLI tasks

* [#13578] - Final refactoring (I hope) and removing unused files

* [#13578] - Updates to the readme and changelog

* [#13578] - Corrections based on review

* [#13578] - Updated nanobox setup files

* [#13578] - Changes based on review

* [#13578] - Added boxfile to the .gitignore

* [#13578] - Added more instructions in the tests/README

* [#13578] - Updated README; Adjusted tests after the merge

* [#13578] - Corrected schema file for Postgresql

* [#13578] - Minor correction; Zephir 0.11.8

* [#13578] - Triggering the build

* [#13578] - Correction to the case statement

* [#13578] - Corrected something in the file - cannot see what character was throwing the scanner off

* [#13578] - Check env variables

* [#13578] - Work on the db environment for travis

* [#13578] - Refactored tests to use dataProviders

* [#13578] - Added again the travis environment variables
@niden
Copy link
Sponsor Member Author

niden commented Dec 5, 2018

This has been addressed

@niden niden closed this as completed Dec 5, 2018
4.0.0 Release automation moved this from In progress to Done Dec 5, 2018
@dschissler

This comment was marked as abuse.

@niden niden added the 4.0 label Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to the framework testing Tests related issue wip Work In Progress
Projects
No open projects
4.0.0 Release
  
Done
Development

No branches or pull requests

3 participants