Skip to content

Commit

Permalink
Updated repo to standard layout
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Jul 30, 2012
1 parent 2868ea6 commit ecd5154
Show file tree
Hide file tree
Showing 12 changed files with 150 additions and 56 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gitattributes export-ignore
.gitignore export-ignore
.travis.yml export-ignore
phpunit.xml export-ignore
phpunit.reports.xml export-ignore
test export-ignore
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
vendor/*
test/report
vendor
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MyDocument {
public function __construct($filename) {
$this->filename = $filename;
}

public function getContents() {
return file_get_contents($this->filename);
}
Expand All @@ -47,7 +47,7 @@ class MyDocument {
$this->filename = $filename;
$this->isolator = Isolator::get($isolator);
}

public function getContents() {
return $this->isolator->file_get_contents($this->filename);
}
Expand All @@ -73,31 +73,31 @@ Phake provides a more flexible alternative to PHPUnit's built-in mock objects.*
```php
<?php
class MyDocumentTest extends PHPUnit_Framework_TestCase {

public function setUp() {
// First a mocked isolator instance is created ...
$this->isolator = Phake::mock('IcecaveStudios\Isolator\Isolator');

// That isolator instance is provided to the MyDocument instance that is to be tested ...
$this->myDocument = new MyDocument('foo.txt', $this->isolator);
}

public function testGetContents() {
// Phake is used to configure the mocked isolator to return
// a known string when file_get_contents() is called with a parameter equal to 'foo.txt' ...
Phake::when($this->isolator)
->file_get_contents('foo.txt')
->thenReturn('This is the file contents.');

// MyDocument::getContents() is called, and it's result checked ...
$contents = $this->myDocument->getContents();
$this->assertEquals($contents, 'This is the file contents.');

// Finally Phake is used to verify that a call to file_get_contents() was made as expected ...
Phake::verify($this->isolator)
->file_get_contents('foo.txt');
}

}
?>
```
Expand All @@ -116,4 +116,4 @@ a great deal of testing of this functionality.

## Author

**Isolator** is written and maintained by [James Harris](http://www.github.com/jmalloc).
**Isolator** is written and maintained by [James Harris](http://www.github.com/jmalloc).
68 changes: 42 additions & 26 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,44 @@
{
"name": "IcecaveStudios/isolator"
, "type": "library"
, "description": "Mock out calls to built-in PHP functions."
, "keywords": [
"test"
, "phpunit"
, "phake"
, "unit"
, "mock"
, "fake"
]
, "homepage": "https://gihub.com/IcecaveStudios/isolator"
, "license": "MIT"
, "authors": [
{
"name": "James Harris"
}
]
, "require": {
"php": ">=5.3.0"
}
, "autoload": {
"psr-0": {
"IcecaveStudios": "deploy/lib"
}
}
"name": "IcecaveStudios/isolator",
"type": "library",
"description": "Mock out calls to built-in PHP functions.",
"keywords": ["test", "phpunit", "phake", "unit", "mock", "fake"],
"homepage": "https://github.com/IcecaveStudios/isolator",
"license": "MIT",
"authors": [
{
"name": "James Harris",
"email": "james.harris@icecave.com.au"
}
],
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phake/phake": "1.*"
},
"autoload": {
"psr-0": {
"IcecaveStudios": "lib"
}
},
"repositories": [
{
"type": "package",
"package": {
"name": "phake/phake",
"version": "1.0.2",
"dist": {
"url": "https://github.com/mlively/Phake/zipball/v1.0.2",
"type": "zip"
},
"autoload": {
"classmap": ["src"]
},
"include-path": [
"src"
]
}
}
]
}
9 changes: 7 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file removed composer.phar
Binary file not shown.
File renamed without changes.
File renamed without changes.
64 changes: 64 additions & 0 deletions phpunit.reports.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="test/bootstrap.php"
strict="true"
mapTestClassNameToCoveredClassName="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
verbose="true"
colors="true"
>
<testsuites>
<testsuite>
<directory>test/suite</directory>
</testsuite>
</testsuites>

<logging>
<log
type="coverage-clover"
target="test/report/coverage.xml"
/>

<log
type="coverage-html"
target="test/report/coverage"
charset="UTF-8"
yui="true"
highlight="true"
/>

<log
type="json"
target="test/report/logfile.json"
/>

<log
type="tap"
target="test/report/logfile.tap"
/>

<log
type="junit"
target="test/report/logfile.xml"
logIncompleteSkipped="false"
/>

<log
type="testdox-html"
target="test/report/testdox.html"
/>

<log
type="testdox-text"
target="test/report/testdox.txt"
/>
</logging>

<filter>
<whitelist>
<directory>lib</directory>
</whitelist>
</filter>
</phpunit>
17 changes: 17 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
bootstrap="test/bootstrap.php"
strict="true"
mapTestClassNameToCoveredClassName="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
verbose="true"
colors="true"
>
<testsuites>
<testsuite>
<directory>test/suite</directory>
</testsuite>
</testsuites>
</phpunit>
6 changes: 3 additions & 3 deletions test/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require 'Phake.php';
Phake::setClient(Phake::CLIENT_PHPUNIT);

require dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
require __DIR__ . '/../vendor/autoload.php';

Phake::setClient(Phake::CLIENT_PHPUNIT);
15 changes: 0 additions & 15 deletions test/phpunit.xml

This file was deleted.

0 comments on commit ecd5154

Please sign in to comment.