Skip to content

Commit

Permalink
Tests, interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Romeo Vegvari committed Mar 23, 2016
1 parent 6511f17 commit 192f2cd
Show file tree
Hide file tree
Showing 6 changed files with 541 additions and 0 deletions.
25 changes: 25 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "vegvari/calendartest",
"description": "Calendar Test",
"license": "MIT",
"authors": [
{
"name": "Romeo Vegvari",
"email": "[email protected]"
}
],
"minimum-stability": "stable",
"require": {
"php": ">=5.6"
},
"autoload": {
"psr-4": {
"Calendar\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Calendar\\": "test/"
}
}
}
21 changes: 21 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<ruleset>
<file>./src</file>
<file>./test</file>

<rule ref="PSR2" />

<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="160" />
</properties>
</rule>

<rule ref="PEAR.Commenting">
<exclude name="PEAR.Commenting.FileComment" />
<exclude name="PEAR.Commenting.ClassComment" />
<exclude name="PEAR.Commenting.FunctionComment.Missing" />
<exclude name="PEAR.Commenting.FunctionComment.MissingParamComment" />
<exclude name="PEAR.Commenting.FunctionComment.MissingReturn" />
</rule>
</ruleset>
27 changes: 27 additions & 0 deletions phpmd.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<ruleset
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">

<rule ref="rulesets/cleancode.xml" />

<rule ref="rulesets/codesize.xml">
<exclude name="TooManyPublicMethods" />
</rule>

<rule ref="rulesets/controversial.xml">
<exclude name="CamelCasePropertyName" />
<exclude name="CamelCaseParameterName" />
<exclude name="CamelCaseVariableName" />
</rule>

<rule ref="rulesets/design.xml" />

<rule ref="rulesets/naming.xml">
<exclude name="ShortMethodName" />
</rule>

<rule ref="rulesets/unusedcode.xml" />
</ruleset>
27 changes: 27 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.1/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="vendor/autoload.php">

<php>
<ini name="error_reporting" value="-16385" />
</php>

<testsuites>
<testsuite name="Alius/Database tests">
<directory>./test/</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<directory>./</directory>
<exclude>
<directory>./test</directory>
<directory>./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
62 changes: 62 additions & 0 deletions src/CalendarInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

namespace Calendar;

use DateTimeInterface;

interface CalendarInterface
{
/**
* @param DateTimeInterface $datetime
*/
public function __construct(DateTimeInterface $datetime);

/**
* Get the day
*
* @return int
*/
public function getDay();

/**
* Get the weekday (1-7, 1 = Monday)
*
* @return int
*/
public function getWeekDay();

/**
* Get the first weekday of this month (1-7, 1 = Monday)
*
* @return int
*/
public function getFirstWeekDay();

/**
* Get the first week of this month (18th March => 9 because March starts on week 9)
*
* @return int
*/
public function getFirstWeek();

/**
* Get the number of days in this month
*
* @return int
*/
public function getNumberOfDaysInThisMonth();

/**
* Get the number of days in the previous month
*
* @return int
*/
public function getNumberOfDaysInPreviousMonth();

/**
* Get the calendar array
*
* @return array
*/
public function getCalendar();
}
Loading

0 comments on commit 192f2cd

Please sign in to comment.