Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
3fb3267
feat(legacy-create-video): Add README
santakadev Apr 20, 2022
160d87d
feat(legacy-create-video): add php base
santakadev Apr 20, 2022
d5a4f2a
feat(legacy-create-video): [golden-master] add base
santakadev Apr 20, 2022
08c6f52
feat(legacy-create-video): [golden-master] setup local development en…
santakadev Apr 20, 2022
0fcd124
feat(legacy-create-video): [golden-master] add characterization test
santakadev Apr 20, 2022
507f63c
feat(legacy-create-video): [golden-master] 100% coverage
santakadev Apr 20, 2022
69f0b2d
feat(legacy-create-video): [golden-master] remove update
santakadev Apr 20, 2022
92bbcc3
feat(legacy-create-video): [golden-master] extract sanitizeTitle method
santakadev Apr 20, 2022
15d90db
feat(legacy-create-video): [golden-master] extract createVideo method
santakadev Apr 20, 2022
da9c61d
feat(legacy-create-video): [golden-master] extract VideoCreator class
santakadev Apr 20, 2022
5b50614
feat(legacy-create-video): [golden-master] inline createVideo method
santakadev Apr 20, 2022
1c8b15d
feat(legacy-create-video): [golden-master] constructor inyection
santakadev Apr 20, 2022
6632627
feat(legacy-create-video): [golden-master] extract save method
santakadev Apr 20, 2022
8316ffe
feat(legacy-create-video): [golden-master] extract MySql video reposi…
santakadev Apr 20, 2022
1f42583
feat(legacy-create-video): [golden-master] 🔵 refactor sanitizeTitle
santakadev Apr 20, 2022
deeded5
feat(legacy-create-video): [golden-master] 🔴 add failing unit test
santakadev Apr 20, 2022
82f8d39
feat(legacy-create-video): [golden-master] 🟢 make test pass
santakadev Apr 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions exercises/legacy_create_video/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Legacy create video

Try to add new features to the legacy code

## User story

There is an HTTP API endpoint to create Codely videos.
When creating videos, we want to ensure that:

- The words "frontend", "Frontend" and "front-end" must be
transformed to "Front-end".
- If the title contains any whitespace at the beginning or
the end, it must be removed.
- If the title contains a final dot, it must be removed.

## Exercise

Available languages:

- [PHP Symfony](base/php-symfony/README.md)
8 changes: 8 additions & 0 deletions exercises/legacy_create_video/base/php-symfony/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/web/bundles/
/app/cache/*
/app/logs/*
/build/
/vendor/
/bin/
/composer.phar
app/config/parameters.yml
22 changes: 22 additions & 0 deletions exercises/legacy_create_video/base/php-symfony/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
language: php

sudo: false

cache:
directories:
- $HOME/.composer/cache

php:
- 5.5
- 5.6
- 7.0
- hhvm

before_install:
- composer self-update

install: composer update $COMPOSER_FLAGS --prefer-dist

after_failure: "cat /home/travis/build/gimler/symfony-rest-edition/app/logs/test.log"

script: phpunit -c app
19 changes: 19 additions & 0 deletions exercises/legacy_create_video/base/php-symfony/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2004-2013 Fabien Potencier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
32 changes: 32 additions & 0 deletions exercises/legacy_create_video/base/php-symfony/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<img src="http://codely.tv/wp-content/uploads/2016/05/cropped-logo-codelyTV.png" align="left" width="192px" height="192px"/>
<img align="left" width="0" height="192px" hspace="10"/>

> Keep it simple :)

[![CodelyTV](https://img.shields.io/badge/code-codely-green.svg?style=flat-square)](codely.tv)

**CodelyTv** is the way to rediscover the programming ;) Trusted by more than 1000 youtube subscribers.

Trust in **Codely**, trust in **you**.

## Quick Start
This is a simple demo of a coupled code.

### 1. Clone this repo
Execute: `git clone https://github.com/CodelyTV/coupled-code-example`

### 2. Install all the dependencies
Composer is used to handle the dependencies. You can download it executing:
`curl -sS https://getcomposer.org/installer | php`

And then you can install all the dependencies executing:
`php composer.phar install`

### 3. Run the tests!
Once you have all the dependencies, in order to execute the tests, run this command:
`bin/phpunit`

## Extra
This code was show in the [From framework coupled code to #microservices through #DDD](http://codely.tv/screencasts/codigo-acoplado-framework-microservicios-ddd) talk.

You have the *CQRS* version of the code [here](https://github.com/CodelyTV/cqrs-ddd-example)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deny from all
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

require_once __DIR__.'/AppKernel.php';

use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;

class AppCache extends HttpCache
{
}
42 changes: 42 additions & 0 deletions exercises/legacy_create_video/base/php-symfony/app/AppKernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new FOS\RestBundle\FOSRestBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new FOS\HttpCacheBundle\FOSHttpCacheBundle(),
new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
new Hautelook\TemplatedUriBundle\HautelookTemplatedUriBundle(),
new Bazinga\Bundle\RestExtraBundle\BazingaRestExtraBundle(),
);

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new AppBundle\AppBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}

return $bundles;
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>{% block title %}Welcome!{% endblock %}</title>
{% block stylesheets %}{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body>
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
</body>
</html>
Loading