Skip to content

Commit

Permalink
Init repo
Browse files Browse the repository at this point in the history
  • Loading branch information
SelrahcD committed Aug 19, 2022
0 parents commit 772e7a7
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_commit: 0.6.1
_src_path: gh:selrahcd/copier-php-kata
include_docker: true
include_sample_test: true
include_tcr_script: true
kata_name: MarsRover
tell_about_test_run_logger: true
test_run_logger: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
vendor
.phpunit.result.cache
test-run-logs.txt
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM php:8.1-cli-alpine

COPY --from=composer /usr/bin/composer /usr/bin/composer

WORKDIR /app

CMD [ "php", "-a" ]
22 changes: 22 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# MarsRover

## Instructions

[See instructions here](https://katalyst.codurance.com/simple-mars-rover)

## Getting started

Run `composer install` to get dependencies.

Alternatively, you can install dependencies using docker with `docker-compose run --rm php composer install`.

## Run tests

You can run tests with PhpUnit using `./vendor/bin/phpunit`.

If you prefer using docker you can run tests with `docker-compose run --rm php ./vendor/bin/phpunit`.

A Test Run Logger is installed and logs all test runs. At the end of the kata you
can take a moment to review the logs and see if you see strange patterns. To make it easier
to review you can write the time when you're entering or leaving a refactoring phase, or when
you're facing difficulties. If you see something weird, what could have you done differently to avoid it?
17 changes: 17 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"require-dev": {
"selrahcd/phpunit-test-run-logger": "0.1",
"phpunit/phpunit": "^9.5"
},
"autoload": {
"psr-4": {
"MarsRover\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"MarsRover\\": "tests/"
}
},
"require": {}
}
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "3.9"

services:
php:
build: .
volumes:
- .:/app
19 changes: 19 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.4/phpunit.xsd"
>

<testsuites>
<testsuite name="All">
<directory>./tests</directory>
</testsuite>
</testsuites>


<extensions>
<extension class="Selrahcd\PhpunitTestRunLogger\TestRunLogger">
</extension>
</extensions>


</phpunit>
Empty file added src/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions tcr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

./vendor/bin/phpunit && git commit -am 'Working' || git checkout -- ./src/
15 changes: 15 additions & 0 deletions tests/SampleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

declare(strict_types=1);

namespace MarsRover;

use PHPUnit\Framework\TestCase;

class SampleTest extends TestCase
{

public function testSample() {
$this->assertTrue(true);
}
}

0 comments on commit 772e7a7

Please sign in to comment.