GithubHelp home page GithubHelp logo

circleci-public / sample-php-laravel Goto Github PK

View Code? Open in Web Editor NEW
93.0 34.0 281.0 10.96 MB

Example CircleCI project using PHP and Laravel

Home Page: https://circleci.com/gh/CircleCI-Public/circleci-demo-php-laravel

Shell 9.13% PHP 15.45% JavaScript 0.07% CSS 19.58% HTML 3.31% Dockerfile 17.24% Groovy 0.05% Python 0.74% VCL 3.58% Less 28.27% Blade 2.57%
circleci circleci-demos php laravel

sample-php-laravel's Introduction

Sample Laravel Application with Codeception tests.

CircleCI

Setup

You can setup this sample use Laradock to automatically set up a development environment for you.

Laradock

  • Install docker and docker-compose
  • Clone repo
  • Create your .env file from the example file: cp .env.testing .env
  • Go to the laradock directory
  • Run docker-compose up -d nginx mysql workspace
  • Browse to http://localhost/

To SSH into the machine to run your tests, run docker exec -it laradock_workspace_1 /bin/bash.

To test

Run Codeception, installed via Composer

./vendor/bin/codecept build
./vendor/bin/codecept run

Tests

Please check out some good test examples provided.

Functional Tests

Demonstrates testing of CRUD application with

  • PageObjects
  • authentication (by user, credentials, http auth)
  • usage of session variables
  • routes
  • creating and checking records in database
  • testing of form errors

API Tests

Demonstrates functional testing of API using REST and Laravel5 modules connected, with

  • partial json inclusion in response
  • GET/POST/PUT/DELETE requests
  • check changes inside database

sample-php-laravel's People

Contributors

bencorlett avatar bpierre avatar codler avatar crynobone avatar cviebrock avatar daylerees avatar ericlbarnes avatar franzliedke avatar grahamcampbell avatar hirokws avatar jakobud avatar janhenkgerritsen avatar jasonlewis avatar jeffreyway avatar jesseobrien avatar kapv89 avatar kbanman avatar lancepioch avatar loic-sharma avatar mikelbring avatar neoascetic avatar pedroborges avatar ryanwohara avatar snyk-bot avatar sparksp avatar taylorotwell avatar tobsn avatar tommyc81 avatar valentinfunk avatar vespakoen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sample-php-laravel's Issues

Add example of nightly scheduled build to circleci/config.yml

Hi there!

I'm trying to set up a nightly build for my project and my config looks like this:

version: 2

jobs:
  build:
    machine: true

    steps:
      - ...

Then I decided to add a nightly scheduled build to it and found https://circleci.com/docs/2.0/workflows/#scheduling-a-workflow

So I added the nightly section to the config:

version: 2

jobs:
  build:
    machine: true

    steps:
      - ...

nightly:
  triggers:
    - schedule:
        cron: "0 0 * * *"

But it doesn't work.


I was wondering is it possible add the example of nightly build to https://github.com/CircleCI-Public/circleci-demo-php-laravel/blob/circleci-2.0/.circleci/config.yml so fellas can easily find it and copy-paste to their projects?

Thanks in advance!

Asset building

Can you perhaps demonstrate how to build assets with yarn too as this is a common requirement in Laravel projects.

Simply running yarn install doesn't work as yarn isn't installed.

I assume we could run a parallel job in a node container but then presumably the result of both containers would need to be merged to run tests against.

For example

composer install
yarn production
phpunit
yarn test
php artisan dusk

The last one needs compiled assets and a working php application.

Extend this example to include a mysql container

Hi there,

Thanks for putting this example together, it has been a great help!

It would be really cool if you could extend it to include a mysql container for the DB layer. I think an example that included a second mysql container would cover typical use cases a lot better.

Thanks!

Cache names are inconcistent

https://github.com/CircleCI-Public/circleci-demo-php-laravel/issues

The cache name is v1-dependencies-{{ checksum "composer.json" }}:

https://github.com/CircleCI-Public/circleci-demo-php-laravel/blob/e817123288067a5daa918a094961595ffe00b185/.circleci/config.yml#L33

Later the name is composer-v1-{{ checksum "composer.lock" }}:

https://github.com/CircleCI-Public/circleci-demo-php-laravel/blob/e817123288067a5daa918a094961595ffe00b185/.circleci/config.yml#L40


According to the documentation, keys have to be identical in restore_cache and save_cache.


How can the cache be restored if names are different?

Error when running PHPUnit and test case with migrations

When running PHPUnit and having a class extending from TestCase and using use RefreshDatabase; for migrations, it returns an error:

Example class:

<?php

namespace Tests\Feature;

use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;

class ExampleTest extends TestCase
{
    use RefreshDatabase;
    
    /**
     * A basic test example.
     *
     * @return void
     */
    public function testBasicTest()
    {
        $response = $this->get('/');

        $response->assertStatus(200);
    }
}

Error:

Illuminate\Database\QueryException: could not find driver (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE')

Is there something to add to the config.yml file?

Update symfony/http-foundation for CVE-2019-10913 and CVE-2019-18888

per GitHub Security alert, the current version of symfony/http-foundation is vulnerable

CVE-2019-10913 critical severity
GHSA-x92h-wmg2-6hp7

Vulnerable versions: >= 3.0.0, < 3.4.26
Patched version: 3.4.26
In Symfony before 2.7.51, 2.8.x before 2.8.50, 3.x before 3.4.26, 4.x before 4.1.12, and 4.2.x before 4.2.7, HTTP Methods provided as verbs or using the override header may be treated as trusted input, but they are not validated, possibly causing SQL injection or XSS. This is related to symfony/http-foundation.

CVE-2019-18888 moderate severity
GHSA-xhh6-956q-4q69

Vulnerable versions: >= 3.0.0, < 3.4.35
Patched version: 3.4.35
An issue was discovered in Symfony 2.8.0 through 2.8.50, 3.4.0 through 3.4.34, 4.2.0 through 4.2.11, and 4.3.0 through 4.3.7. If an application passes unvalidated user input as the file for which MIME type validation should occur, then arbitrary arguments are passed to the underlying file command. This is related to symfony/http-foundation (and symfony/mime in 4.3.x).

Their suggested remediation is

Upgrade symfony/http-foundation to version 3.4.35 or later. For example:

"require": {
  "symfony/http-foundation": "3.4.35"
}

How to use parallelism with PHPUnit?

I’m struggling to find any documentation or references on how to run PHPUnit across multiple containers with parallelism.

If I have parallelism: 2 in my .circleci/config.yml file, the whole PHPUnit test suite is ran on both instances. How can I “split” my test suite so that some tests are ran in one container, and the other tests ran in the second container?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.