diff --git a/composer.json b/composer.json
index 30db1ae..a93cf34 100644
--- a/composer.json
+++ b/composer.json
@@ -29,20 +29,20 @@
},
"require": {
"php": ">=5.6.0",
- "symfony/console": "^3.1",
- "symfony/filesystem": "^3.1",
- "symfony/finder" : "^3.1",
- "symfony/yaml": "^3.1",
- "league/container": "^2.2",
- "league/plates": "^3.1",
+ "symfony/console": "^3.4",
+ "symfony/filesystem": "^3.4",
+ "symfony/finder" : "^3.4",
+ "symfony/yaml": "^3.4",
+ "symfony/process": "^3.4",
+ "league/container": "^2.4",
+ "league/plates": "^3.3",
"league/event": "^2.1",
- "nesbot/carbon": "^1.21",
+ "nesbot/carbon": "^1",
"composer/semver": "^1.4",
- "michelf/php-markdown": "^1.7",
- "symfony/process": "^3.4"
+ "michelf/php-markdown": "^1.7"
},
"require-dev": {
- "phpunit/phpunit": "5.7.*"
+ "phpunit/phpunit": "^5"
},
"bin": [
"bin/tapestry.php"
diff --git a/composer.lock b/composer.lock
index 323eead..8297fdf 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "876e437b11a39083140fa331ab9f1b3a",
+ "content-hash": "39658cc0978003cdb7dd516c9c9019eb",
"packages": [
{
"name": "composer/semver",
@@ -471,44 +471,45 @@
},
{
"name": "symfony/console",
- "version": "v3.3.10",
+ "version": "v3.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "116bc56e45a8e5572e51eb43ab58c769a352366c"
+ "reference": "9f21adfb92a9315b73ae2ed43138988ee4913d4e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/116bc56e45a8e5572e51eb43ab58c769a352366c",
- "reference": "116bc56e45a8e5572e51eb43ab58c769a352366c",
+ "url": "https://api.github.com/repos/symfony/console/zipball/9f21adfb92a9315b73ae2ed43138988ee4913d4e",
+ "reference": "9f21adfb92a9315b73ae2ed43138988ee4913d4e",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8",
- "symfony/debug": "~2.8|~3.0",
+ "symfony/debug": "~2.8|~3.0|~4.0",
"symfony/polyfill-mbstring": "~1.0"
},
"conflict": {
- "symfony/dependency-injection": "<3.3"
+ "symfony/dependency-injection": "<3.4",
+ "symfony/process": "<3.3"
},
"require-dev": {
"psr/log": "~1.0",
- "symfony/config": "~3.3",
- "symfony/dependency-injection": "~3.3",
- "symfony/event-dispatcher": "~2.8|~3.0",
- "symfony/filesystem": "~2.8|~3.0",
- "symfony/process": "~2.8|~3.0"
+ "symfony/config": "~3.3|~4.0",
+ "symfony/dependency-injection": "~3.4|~4.0",
+ "symfony/event-dispatcher": "~2.8|~3.0|~4.0",
+ "symfony/lock": "~3.4|~4.0",
+ "symfony/process": "~3.3|~4.0"
},
"suggest": {
"psr/log": "For using the console logger",
"symfony/event-dispatcher": "",
- "symfony/filesystem": "",
+ "symfony/lock": "",
"symfony/process": ""
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.3-dev"
+ "dev-master": "3.4-dev"
}
},
"autoload": {
@@ -535,20 +536,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2017-10-02T06:42:24+00:00"
+ "time": "2017-12-14T19:40:10+00:00"
},
{
"name": "symfony/debug",
- "version": "v3.3.10",
+ "version": "v3.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/debug.git",
- "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd"
+ "reference": "543deab3ffff94402440b326fc94153bae2dfa7a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/debug/zipball/eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd",
- "reference": "eb95d9ce8f18dcc1b3dfff00cb624c402be78ffd",
+ "url": "https://api.github.com/repos/symfony/debug/zipball/543deab3ffff94402440b326fc94153bae2dfa7a",
+ "reference": "543deab3ffff94402440b326fc94153bae2dfa7a",
"shasum": ""
},
"require": {
@@ -559,12 +560,12 @@
"symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
},
"require-dev": {
- "symfony/http-kernel": "~2.8|~3.0"
+ "symfony/http-kernel": "~2.8|~3.0|~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.3-dev"
+ "dev-master": "3.4-dev"
}
},
"autoload": {
@@ -591,20 +592,20 @@
],
"description": "Symfony Debug Component",
"homepage": "https://symfony.com",
- "time": "2017-10-02T06:42:24+00:00"
+ "time": "2017-12-12T08:27:14+00:00"
},
{
"name": "symfony/filesystem",
- "version": "v3.3.10",
+ "version": "v3.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
- "reference": "90bc45abf02ae6b7deb43895c1052cb0038506f1"
+ "reference": "25b135bea251829e3db6a77d773643408b575ed4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/filesystem/zipball/90bc45abf02ae6b7deb43895c1052cb0038506f1",
- "reference": "90bc45abf02ae6b7deb43895c1052cb0038506f1",
+ "url": "https://api.github.com/repos/symfony/filesystem/zipball/25b135bea251829e3db6a77d773643408b575ed4",
+ "reference": "25b135bea251829e3db6a77d773643408b575ed4",
"shasum": ""
},
"require": {
@@ -613,7 +614,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.3-dev"
+ "dev-master": "3.4-dev"
}
},
"autoload": {
@@ -640,20 +641,20 @@
],
"description": "Symfony Filesystem Component",
"homepage": "https://symfony.com",
- "time": "2017-10-03T13:33:10+00:00"
+ "time": "2017-12-14T19:40:10+00:00"
},
{
"name": "symfony/finder",
- "version": "v3.3.10",
+ "version": "v3.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "773e19a491d97926f236942484cb541560ce862d"
+ "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/773e19a491d97926f236942484cb541560ce862d",
- "reference": "773e19a491d97926f236942484cb541560ce862d",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/dac8d7db537bac7ad8143eb11360a8c2231f251a",
+ "reference": "dac8d7db537bac7ad8143eb11360a8c2231f251a",
"shasum": ""
},
"require": {
@@ -662,7 +663,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.3-dev"
+ "dev-master": "3.4-dev"
}
},
"autoload": {
@@ -689,7 +690,7 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
- "time": "2017-10-02T06:42:24+00:00"
+ "time": "2017-11-05T16:10:10+00:00"
},
{
"name": "symfony/polyfill-mbstring",
@@ -801,16 +802,16 @@
},
{
"name": "symfony/translation",
- "version": "v3.3.10",
+ "version": "v3.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
- "reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f"
+ "reference": "4c5d5582baf2829751a5207659329c1f52eedeb6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/translation/zipball/409bf229cd552bf7e3faa8ab7e3980b07672073f",
- "reference": "409bf229cd552bf7e3faa8ab7e3980b07672073f",
+ "url": "https://api.github.com/repos/symfony/translation/zipball/4c5d5582baf2829751a5207659329c1f52eedeb6",
+ "reference": "4c5d5582baf2829751a5207659329c1f52eedeb6",
"shasum": ""
},
"require": {
@@ -819,13 +820,16 @@
},
"conflict": {
"symfony/config": "<2.8",
- "symfony/yaml": "<3.3"
+ "symfony/dependency-injection": "<3.4",
+ "symfony/yaml": "<3.4"
},
"require-dev": {
"psr/log": "~1.0",
- "symfony/config": "~2.8|~3.0",
- "symfony/intl": "^2.8.18|^3.2.5",
- "symfony/yaml": "~3.3"
+ "symfony/config": "~2.8|~3.0|~4.0",
+ "symfony/dependency-injection": "~3.4|~4.0",
+ "symfony/finder": "~2.8|~3.0|~4.0",
+ "symfony/intl": "^2.8.18|^3.2.5|~4.0",
+ "symfony/yaml": "~3.4|~4.0"
},
"suggest": {
"psr/log": "To use logging capability in translator",
@@ -835,7 +839,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.3-dev"
+ "dev-master": "3.4-dev"
}
},
"autoload": {
@@ -862,27 +866,30 @@
],
"description": "Symfony Translation Component",
"homepage": "https://symfony.com",
- "time": "2017-10-02T06:42:24+00:00"
+ "time": "2017-12-12T08:27:14+00:00"
},
{
"name": "symfony/yaml",
- "version": "v3.3.10",
+ "version": "v3.4.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46"
+ "reference": "afe0cd38486505c9703707707d91450cfc1bd536"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46",
- "reference": "8c7bf1e7d5d6b05a690b715729cb4cd0c0a99c46",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/afe0cd38486505c9703707707d91450cfc1bd536",
+ "reference": "afe0cd38486505c9703707707d91450cfc1bd536",
"shasum": ""
},
"require": {
"php": "^5.5.9|>=7.0.8"
},
+ "conflict": {
+ "symfony/console": "<3.4"
+ },
"require-dev": {
- "symfony/console": "~2.8|~3.0"
+ "symfony/console": "~3.4|~4.0"
},
"suggest": {
"symfony/console": "For validating YAML files using the lint command"
@@ -890,7 +897,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.3-dev"
+ "dev-master": "3.4-dev"
}
},
"autoload": {
@@ -917,7 +924,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
- "time": "2017-10-05T14:43:42+00:00"
+ "time": "2017-12-11T20:38:23+00:00"
}
],
"packages-dev": [
@@ -1076,22 +1083,22 @@
},
{
"name": "phpdocumentor/reflection-docblock",
- "version": "3.2.2",
+ "version": "3.3.2",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
- "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157"
+ "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/4aada1f93c72c35e22fb1383b47fee43b8f1d157",
- "reference": "4aada1f93c72c35e22fb1383b47fee43b8f1d157",
+ "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bf329f6c1aadea3299f08ee804682b7c45b326a2",
+ "reference": "bf329f6c1aadea3299f08ee804682b7c45b326a2",
"shasum": ""
},
"require": {
- "php": ">=5.5",
- "phpdocumentor/reflection-common": "^1.0@dev",
- "phpdocumentor/type-resolver": "^0.3.0",
+ "php": "^5.6 || ^7.0",
+ "phpdocumentor/reflection-common": "^1.0.0",
+ "phpdocumentor/type-resolver": "^0.4.0",
"webmozart/assert": "^1.0"
},
"require-dev": {
@@ -1117,20 +1124,20 @@
}
],
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
- "time": "2017-08-08T06:39:58+00:00"
+ "time": "2017-11-10T14:09:06+00:00"
},
{
"name": "phpdocumentor/type-resolver",
- "version": "0.3.0",
+ "version": "0.4.0",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/TypeResolver.git",
- "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773"
+ "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fb3933512008d8162b3cdf9e18dba9309b7c3773",
- "reference": "fb3933512008d8162b3cdf9e18dba9309b7c3773",
+ "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7",
+ "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7",
"shasum": ""
},
"require": {
@@ -1164,20 +1171,20 @@
"email": "me@mikevanriel.com"
}
],
- "time": "2017-06-03T08:32:36+00:00"
+ "time": "2017-07-14T14:27:02+00:00"
},
{
"name": "phpspec/prophecy",
- "version": "v1.7.2",
+ "version": "1.7.3",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
- "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6"
+ "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6",
- "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6",
+ "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
+ "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf",
"shasum": ""
},
"require": {
@@ -1189,7 +1196,7 @@
},
"require-dev": {
"phpspec/phpspec": "^2.5|^3.2",
- "phpunit/phpunit": "^4.8 || ^5.6.5"
+ "phpunit/phpunit": "^4.8.35 || ^5.7"
},
"type": "library",
"extra": {
@@ -1227,7 +1234,7 @@
"spy",
"stub"
],
- "time": "2017-09-04T11:05:03+00:00"
+ "time": "2017-11-24T13:59:53+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -1294,16 +1301,16 @@
},
{
"name": "phpunit/php-file-iterator",
- "version": "1.4.2",
+ "version": "1.4.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
- "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5"
+ "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
- "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4",
+ "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4",
"shasum": ""
},
"require": {
@@ -1337,7 +1344,7 @@
"filesystem",
"iterator"
],
- "time": "2016-10-03T07:40:28+00:00"
+ "time": "2017-11-27T13:52:08+00:00"
},
{
"name": "phpunit/php-text-template",
@@ -1431,16 +1438,16 @@
},
{
"name": "phpunit/php-token-stream",
- "version": "1.4.11",
+ "version": "1.4.12",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-token-stream.git",
- "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7"
+ "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7",
- "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16",
+ "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16",
"shasum": ""
},
"require": {
@@ -1476,20 +1483,20 @@
"keywords": [
"tokenizer"
],
- "time": "2017-02-27T10:12:30+00:00"
+ "time": "2017-12-04T08:55:13+00:00"
},
{
"name": "phpunit/phpunit",
- "version": "5.7.23",
+ "version": "5.7.26",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "78532d5269d984660080d8e0f4c99c5c2ea65ffe"
+ "reference": "7fbc25c13309de0c4c9bb48b7361f1eca34c7fbd"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/78532d5269d984660080d8e0f4c99c5c2ea65ffe",
- "reference": "78532d5269d984660080d8e0f4c99c5c2ea65ffe",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/7fbc25c13309de0c4c9bb48b7361f1eca34c7fbd",
+ "reference": "7fbc25c13309de0c4c9bb48b7361f1eca34c7fbd",
"shasum": ""
},
"require": {
@@ -1514,7 +1521,7 @@
"sebastian/object-enumerator": "~2.0",
"sebastian/resource-operations": "~1.0",
"sebastian/version": "~1.0.3|~2.0",
- "symfony/yaml": "~2.1|~3.0"
+ "symfony/yaml": "~2.1|~3.0|~4.0"
},
"conflict": {
"phpdocumentor/reflection-docblock": "3.0.2"
@@ -1558,7 +1565,7 @@
"testing",
"xunit"
],
- "time": "2017-10-15T06:13:55+00:00"
+ "time": "2017-12-17T06:14:38+00:00"
},
{
"name": "phpunit/phpunit-mock-objects",
diff --git a/phpunit.xml b/phpunit.xml
index c307eae..4b8fe2a 100644
--- a/phpunit.xml
+++ b/phpunit.xml
@@ -1,25 +1,19 @@
-
-
-
-
-
-
-
+ stopOnFailure="false">
-
- ./tests/
+
+ ./tests/Feature
+
+
+ ./tests/Unit
@@ -32,4 +26,9 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Tapestry.php b/src/Tapestry.php
index 680be4a..c4e5534 100644
--- a/src/Tapestry.php
+++ b/src/Tapestry.php
@@ -181,7 +181,7 @@ public static function getInstance()
/**
* @param Tapestry $tapestry
*/
- public static function setInstance(self $tapestry)
+ public static function setInstance(self $tapestry = null)
{
static::$instance = $tapestry;
}
diff --git a/tests/.gitkeep b/tests/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/BuildCommandTest.php b/tests/BuildCommandTest.php
deleted file mode 100644
index e614349..0000000
--- a/tests/BuildCommandTest.php
+++ /dev/null
@@ -1,373 +0,0 @@
-assertEquals(self::$tmpPath, getcwd());
- }
-
- public function testDefaultInit()
- {
- $this->copyDirectory('/assets/build_test_1/src', '/_tmp');
-
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileExists(self::$tmpPath.DIRECTORY_SEPARATOR.'build_local');
- $this->assertFileExists(self::$tmpPath.DIRECTORY_SEPARATOR.'build_local'.DIRECTORY_SEPARATOR.'index.html');
- $this->assertFileExists(self::$tmpPath.DIRECTORY_SEPARATOR.'build_local'.DIRECTORY_SEPARATOR.'about.html');
- $this->assertFileExists(self::$tmpPath.DIRECTORY_SEPARATOR.'build_local'.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'js'.DIRECTORY_SEPARATOR.'app.js');
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_1/check/about.html',
- __DIR__.'/_tmp/build_local/about.html',
- '',
- true
- );
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_1/check/index.html',
- __DIR__.'/_tmp/build_local/index.html',
- '',
- true
- );
- }
-
- public function testMarkdownFrontmatterParsedOut()
- {
- $this->copyDirectory('assets/build_test_2/src', '_tmp');
-
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_2/check/about.html',
- __DIR__.'/_tmp/build_local/about.html',
- '',
- true
- );
- }
-
- public function testPrettyPermalinksParsed()
- {
- $this->copyDirectory('assets/build_test_3/src', '_tmp');
-
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_3/check/index.html',
- __DIR__.'/_tmp/build_local/index.html',
- '',
- true
- );
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_3/check/about.html',
- __DIR__.'/_tmp/build_local/about/index.html',
- '',
- true
- );
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_3/check/not-pretty.html',
- __DIR__.'/_tmp/build_local/not-pretty.html',
- '',
- true
- );
- }
-
- public function testSiteDistOption()
- {
- $this->copyDirectory('assets/build_test_3/src', '_tmp');
- $output = $this->runCommand('build', '--quiet --dist-dir=' . __DIR__ . '/_tmp/test_dist_dir');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileExists(__DIR__.'/_tmp/test_dist_dir/index.html');
- $this->assertFileExists(__DIR__.'/_tmp/test_dist_dir/about/index.html');
- $this->assertFileExists(__DIR__.'/_tmp/test_dist_dir/not-pretty.html');
- }
-
- /**
- * Written for issue 89
- * @link https://github.com/carbontwelve/tapestry/issues/89
- */
- public function testFrontmatterDataParsingSucceeds()
- {
- $this->copyDirectory('assets/build_test_24/src', '_tmp');
- $output = $this->runCommand('build', '--quiet --dist-dir=' . __DIR__ . '/_tmp/test_dist_dir');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
- }
-
- /**
- * Written for issue 89
- * @link https://github.com/carbontwelve/tapestry/issues/89
- */
- public function testFrontmatterDataParsingFails()
- {
- $this->copyDirectory('assets/build_test_25/src', '_tmp');
- $output = $this->runCommand('build', '--quiet --dist-dir=' . __DIR__ . '/_tmp/test_dist_dir');
- $this->assertContains('[!] The date [abc] is in a format not supported by Tapestry', trim($output->getDisplay()));
- $this->assertEquals(1, $output->getStatusCode());
- }
-
- /**
- * Written for issue 121
- * @link https://github.com/carbontwelve/tapestry/issues/121
- */
- public function testFilterFunctionality()
- {
- $this->copyDirectory('assets/build_test_4/src', '_tmp');
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- // Folders prefixed with a underscore should be ignored by default.
- $this->assertFileNotExists(__DIR__ . '/_tmp/build_local/_templates');
-
- // Folders set to be ignored, should be ignored.
- $this->assertFileNotExists(__DIR__ . '/_tmp/build_local/ignored_folder');
-
- // Unless they are set to be copied.
- $this->assertfileExists(__DIR__ . '/_tmp/build_local/assets');
- $this->assertFileEquals(__DIR__ .'/assets/build_test_4/src/source/assets/js/app.js', __DIR__ . '/_tmp/build_local/assets/js/app.js');
- $this->assertFileEquals(__DIR__ .'/assets/build_test_4/src/source/assets/js/something_else/a.js', __DIR__ . '/_tmp/build_local/assets/js/something_else/a.js');
- $this->assertFileEquals(__DIR__ .'/assets/build_test_4/src/source/assets/js/something_else/b.js', __DIR__ . '/_tmp/build_local/assets/js/something_else/b.js');
- }
-
- /**
- * Written for issue #123
- * @link https://github.com/carbontwelve/tapestry/issues/123
- */
- public function testPHPAsPHTML()
- {
- $this->copyDirectory('assets/build_test_29/src', '_tmp');
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_29/check/index.html',
- __DIR__.'/_tmp/build_local/index.html',
- '',
- true
- );
- }
-
- /**
- * Written for issue #130
- * Originally from a previous incarnation of Tapestry this tests that input files produce the correct output paths.
- *
- * @link https://github.com/carbontwelve/tapestry/issues/130
- */
- public function testComplexBaseBuild()
- {
- $this->copyDirectory('assets/build_test_5/src', '_tmp');
-
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/a_folder/b_folder/b-file/index.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/a_folder/a-file/index.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/a_folder/another-file/index.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/b_folder/b-file-2/index.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/b_folder/b-file-3.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/about/index.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/index.html');
- }
-
- /**
- * Written for issue #131
- * @link https://github.com/carbontwelve/tapestry/issues/131
- */
- public function testFrontmatterTemplateLoading()
- {
- $this->copyDirectory('assets/build_test_6/src', '_tmp');
-
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileEquals(__DIR__ .'/assets/build_test_6/check/index.html', __DIR__ . '/_tmp/build_local/index.html');
- }
-
- /**
- * Written for issue #132
- * @link https://github.com/carbontwelve/tapestry/issues/132
- */
- public function testFontmatterPermalinks()
- {
- $this->copyDirectory('assets/build_test_7/src', '_tmp');
-
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/abc/123/file.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/123/abc/file.xml');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/rah.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/about/index.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/test/testing/testy/index.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/blog/2016/02/test.html');
- }
-
- /**
- * Written for issue #136
- * @link https://github.com/carbontwelve/tapestry/issues/136
- */
- public function testBlogPostBuild()
- {
- $this->copyDirectory('assets/build_test_11/src', '_tmp');
-
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_11/check/blog/2016/test-blog-entry.html',
- __DIR__.'/_tmp/build_local/blog/2016/test-blog-entry/index.html',
- '',
- true
- );
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_11/check/blog/2016/test-blog-entry-two.html',
- __DIR__.'/_tmp/build_local/blog/2016/test-blog-entry-two/index.html',
- '',
- true
- );
- }
-
- /**
- * Written for issue #152
- * @link https://github.com/carbontwelve/tapestry/issues/152
- */
- public function testIgnoreUnderscorePaths()
- {
- $this->copyDirectory('assets/build_test_30/src', '_tmp');
-
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileNotExists(__DIR__ . '/_tmp/build_local/_should-not-exist/index.html');
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/should-exist/index.html');
- $this->assertFileNotExists(__DIR__ . '/_tmp/build_local/should-exist/_should-not-exist/index.html');
- }
-
- /**
- * Written for issue #158
- * @link https://github.com/carbontwelve/tapestry/issues/158
- */
- public function testFileTemplatePassthrough()
- {
- $this->copyDirectory('assets/build_test_31/src', '_tmp');
-
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_31/check/single.html',
- __DIR__.'/_tmp/build_local/single/index.html',
- '',
- true
- );
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_31/check/base.html',
- __DIR__.'/_tmp/build_local/base/index.html',
- '',
- true
- );
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_31/check/blog.html',
- __DIR__.'/_tmp/build_local/blog/2016/test/index.html',
- '',
- true
- );
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_31/check/page.html',
- __DIR__.'/_tmp/build_local/page/index.html',
- '',
- true
- );
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_31/check/page-multi.html',
- __DIR__.'/_tmp/build_local/page-multi/index.html',
- '',
- true
- );
- }
-
- /**
- * Written for issue #208
- * @link https://github.com/carbontwelve/tapestry/issues/208
- */
- public function testDoubleDotFileExt()
- {
- $this->copyDirectory('assets/build_test_35/src', '_tmp');
-
- $output = $this->runCommand('build', '--quiet');
-
- $this->assertEquals('', trim($output->getDisplay()));
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileNotExists(__DIR__.'/_tmp/build_local/css/main-min.css');
- $this->assertFileExists(__DIR__.'/_tmp/build_local/css/main.min.css');
-
- $this->assertFileNotExists(__DIR__.'/_tmp/build_local/abc-123-xyz.html');
- $this->assertFileExists(__DIR__.'/_tmp/build_local/abc.123.xyz.html');
- }
-
- /**
- * Written for issue #156
- * @link https://github.com/carbontwelve/tapestry/issues/156
- */
- public function testPermalinkClashes()
- {
- $this->copyDirectory('assets/build_test_36/src', '_tmp');
-
- $output = $this->runCommand('build', '');
- $this->assertTrue(strpos(trim($output->getDisplay()), 'The permalink [/file-clash.html] is already in use!') !== false);
- $this->assertEquals(1, $output->getStatusCode());
- }
-
- /**
- * Written for issue #255
- * @link https://github.com/tapestry-cloud/tapestry/issues/255
- */
- public function testPermalinkClashesOnStatic()
- {
- $this->copyDirectory('assets/build_test_39/src', '_tmp');
- $output = $this->runCommand('build', '');
- $this->assertEquals(0, $output->getStatusCode());
- }
-}
diff --git a/tests/CommandLineApplicationTest.php b/tests/CommandLineApplicationTest.php
deleted file mode 100644
index e20c0a1..0000000
--- a/tests/CommandLineApplicationTest.php
+++ /dev/null
@@ -1,14 +0,0 @@
-runCommand('', '--version');
- $this->assertEquals('Tapestry version '.Tapestry::VERSION.', environment local', trim($output->getDisplay()));
- }
-}
diff --git a/tests/CommandTestBase.php b/tests/CommandTestBase.php
index 6a64781..d3ecaa7 100644
--- a/tests/CommandTestBase.php
+++ b/tests/CommandTestBase.php
@@ -2,7 +2,6 @@
namespace Tapestry\Tests;
-use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Tester\ApplicationTester;
use Symfony\Component\Filesystem\Filesystem;
use Tapestry\Console\Application;
diff --git a/tests/ContentTypeTest.php b/tests/ContentTypeTest.php
deleted file mode 100644
index 36c5ee4..0000000
--- a/tests/ContentTypeTest.php
+++ /dev/null
@@ -1,96 +0,0 @@
-copyDirectory('assets/build_test_16/src', '_tmp');
- $output = $this->runCommand('build', '--quiet');
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_16/check/index.html',
- __DIR__.'/_tmp/build_local/index.html',
- '',
- true
- );
- }
-
- public function testPreviousNextOrder(){
- $this->copyDirectory('assets/build_test_18/src', '_tmp');
- $output = $this->runCommand('build', '--quiet');
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_18/check/first-post.html',
- __DIR__.'/_tmp/build_local/blog/2015/first-post/index.html',
- '',
- true
- );
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_18/check/second-post.html',
- __DIR__.'/_tmp/build_local/blog/2015/second-post/index.html',
- '',
- true
- );
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_18/check/third-post.html',
- __DIR__.'/_tmp/build_local/blog/2015/third-post/index.html',
- '',
- true
- );
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_18/check/fourth-post.html',
- __DIR__.'/_tmp/build_local/blog/2015/fourth-post/index.html',
- '',
- true
- );
- }
-
- /**
- * Added for issue 88
- * @see https://github.com/carbontwelve/tapestry/issues/88
- */
- public function testAddFileMutatesFileDataWithContentTypeName()
- {
- $contentType = new ContentType('Test', ['enabled' => true]);
- $file = new File(new SplFileInfo(__DIR__ . '/Mocks/TestFile.md', '', ''));
- $this->assertFalse($file->hasData('contentType'));
- $contentType->addFile($file);
- $this->assertTrue($file->hasData('contentType'));
- }
-
- /**
- * Added for issue 87
- * @see https://github.com/carbontwelve/tapestry/issues/87
- */
- public function testContentTypeFactoryArrayAccessByKey()
- {
- $contentType = new ContentType('Test', ['enabled' => true]);
- $contentTypeFactory = new ContentTypeFactory([
- $contentType
- ]);
- $this->assertTrue($contentTypeFactory->has('_Test'));
- $this->assertEquals($contentType, $contentTypeFactory->arrayAccessByKey('Test'));
- $this->assertEquals(null, $contentTypeFactory->arrayAccessByKey('NonExistant'));
- }
-
- /**
- * Added for issue 86
- * @see https://github.com/carbontwelve/tapestry/issues/86
- */
- public function testContentTypeEnabled()
- {
- $contentType = new ContentType('Test', []);
- $this->assertFalse($contentType->isEnabled());
- $contentType = new ContentType('Test', ['enabled' => true]);
- $this->assertTrue($contentType->isEnabled());
- }
-}
diff --git a/tests/CreatesTapestry.php b/tests/CreatesTapestry.php
new file mode 100644
index 0000000..f59cbd0
--- /dev/null
+++ b/tests/CreatesTapestry.php
@@ -0,0 +1,13 @@
+assertEquals($this->tmpPath(), getcwd());
+ }
+
+ public function testDefaultInit()
+ {
+ $this->loadToTmp($this->assetPath('build_test_1/src'));
+
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileExists($this->tmpPath('build_local'));
+ $this->assertFileExists($this->tmpPath('build_local'.DIRECTORY_SEPARATOR.'index.html'));
+ $this->assertFileExists($this->tmpPath('build_local'.DIRECTORY_SEPARATOR.'about.html'));
+ $this->assertFileExists($this->tmpPath('build_local'.DIRECTORY_SEPARATOR.'assets'.DIRECTORY_SEPARATOR.'js'.DIRECTORY_SEPARATOR.'app.js'));
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_1/check/about.html'),
+ $this->tmpPath('/build_local/about.html'),
+ '',
+ true
+ );
+ $this->assertFileEquals(
+ $this->assetPath('build_test_1/check/index.html'),
+ $this->tmpPath('build_local/index.html'),
+ '',
+ true
+ );
+ }
+
+ public function testMarkdownFrontMatterParsedOut()
+ {
+ $this->loadToTmp($this->assetPath('build_test_2/src'));
+
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_2/check/about.html'),
+ $this->tmpPath('build_local/about.html'),
+ '',
+ true
+ );
+ }
+
+ public function testPrettyPermalinksParsed()
+ {
+ $this->loadToTmp($this->assetPath('build_test_3/src'));
+
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_3/check/index.html'),
+ $this->tmpPath('build_local/index.html'),
+ '',
+ true
+ );
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_3/check/about.html'),
+ $this->tmpPath('build_local/about/index.html'),
+ '',
+ true
+ );
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_3/check/not-pretty.html'),
+ $this->tmpPath('build_local/not-pretty.html'),
+ '',
+ true
+ );
+ }
+
+ public function testSiteDistOption()
+ {
+ $this->loadToTmp($this->assetPath('build_test_3/src'));
+ $output = $this->runCommand('build', '--quiet --dist-dir=' . $this->tmpPath('test_dist_dir'));
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileExists($this->tmpPath('test_dist_dir/index.html'));
+ $this->assertFileExists($this->tmpPath('test_dist_dir/about/index.html'));
+ $this->assertFileExists($this->tmpPath('test_dist_dir/not-pretty.html'));
+ }
+
+ /**
+ * Written for issue 89
+ * @link https://github.com/carbontwelve/tapestry/issues/89
+ */
+ public function testFrontMatterDataParsingSucceeds()
+ {
+ $this->loadToTmp($this->assetPath('build_test_24/src'));
+ $output = $this->runCommand('build', '--quiet --dist-dir=' . $this->tmpPath('test_dist_dir'));
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+ }
+
+ /**
+ * Written for issue 89
+ * @link https://github.com/carbontwelve/tapestry/issues/89
+ */
+ public function testFrontMatterDataParsingFails()
+ {
+ $this->loadToTmp($this->assetPath('build_test_25/src'));
+ $output = $this->runCommand('build', '--quiet --dist-dir=' . $this->tmpPath('test_dist_dir'));
+ $this->assertContains('[!] The date [abc] is in a format not supported by Tapestry', trim($output->getDisplay()));
+ $this->assertEquals(1, $output->getStatusCode());
+ }
+
+ /**
+ * Written for issue 121
+ * @link https://github.com/carbontwelve/tapestry/issues/121
+ */
+ public function testFilterFunctionality()
+ {
+ $this->loadToTmp($this->assetPath('build_test_4/src'));
+
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ // Folders prefixed with a underscore should be ignored by default.
+ $this->assertFileNotExists($this->tmpPath('build_local/_templates'));
+
+ // Folders set to be ignored, should be ignored.
+ $this->assertFileNotExists($this->tmpPath('build_local/ignored_folder'));
+
+ // Unless they are set to be copied.
+ $this->assertfileExists($this->tmpPath('build_local/assets'));
+ $this->assertFileEquals($this->assetPath('build_test_4/src/source/assets/js/app.js'), $this->tmpPath('build_local/assets/js/app.js'));
+ $this->assertFileEquals($this->assetPath('build_test_4/src/source/assets/js/something_else/a.js'), $this->tmpPath('build_local/assets/js/something_else/a.js'));
+ $this->assertFileEquals($this->assetPath('build_test_4/src/source/assets/js/something_else/b.js'), $this->tmpPath('build_local/assets/js/something_else/b.js'));
+ }
+
+ /**
+ * Written for issue #123
+ * @link https://github.com/carbontwelve/tapestry/issues/123
+ */
+ public function testPHPAsPHTML()
+ {
+ $this->loadToTmp($this->assetPath('build_test_29/src'));
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_29/check/index.html'),
+ $this->tmpPath('build_local/index.html'),
+ '',
+ true
+ );
+ }
+
+ /**
+ * Written for issue #130
+ * Originally from a previous incarnation of Tapestry this tests that input files produce the correct output paths.
+ *
+ * @link https://github.com/carbontwelve/tapestry/issues/130
+ */
+ public function testComplexBaseBuild()
+ {
+ $this->loadToTmp($this->assetPath('build_test_5/src'));
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileExists($this->tmpPath('build_local/a_folder/b_folder/b-file/index.html'));
+ $this->assertFileExists($this->tmpPath('build_local/a_folder/a-file/index.html'));
+ $this->assertFileExists($this->tmpPath('build_local/a_folder/another-file/index.html'));
+ $this->assertFileExists($this->tmpPath('build_local/b_folder/b-file-2/index.html'));
+ $this->assertFileExists($this->tmpPath('build_local/b_folder/b-file-3.html'));
+ $this->assertFileExists($this->tmpPath('build_local/about/index.html'));
+ $this->assertFileExists($this->tmpPath('build_local/index.html'));
+ }
+
+ /**
+ * Written for issue #131
+ * @link https://github.com/carbontwelve/tapestry/issues/131
+ */
+ public function testFrontMatterTemplateLoading()
+ {
+ $this->loadToTmp($this->assetPath('build_test_6/src'));
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileEquals($this->assetPath('build_test_6/check/index.html'), $this->tmpPath('build_local/index.html'));
+ }
+
+ /**
+ * Written for issue #132
+ * @link https://github.com/carbontwelve/tapestry/issues/132
+ */
+ public function testFontMatterPermainks()
+ {
+ $this->loadToTmp($this->assetPath('build_test_7/src'));
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileExists($this->tmpPath('build_local/abc/123/file.html'));
+ $this->assertFileExists($this->tmpPath('build_local/123/abc/file.xml'));
+ $this->assertFileExists($this->tmpPath('build_local/rah.html'));
+ $this->assertFileExists($this->tmpPath('build_local/about/index.html'));
+ $this->assertFileExists($this->tmpPath('build_local/test/testing/testy/index.html'));
+ $this->assertFileExists($this->tmpPath('build_local/blog/2016/02/test.html'));
+ }
+
+ /**
+ * Written for issue #136
+ * @link https://github.com/carbontwelve/tapestry/issues/136
+ */
+ public function testBlogPostBuild()
+ {
+ $this->loadToTmp($this->assetPath('build_test_11/src'));
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_11/check/blog/2016/test-blog-entry.html'),
+ $this->tmpPath('build_local/blog/2016/test-blog-entry/index.html'),
+ '',
+ true
+ );
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_11/check/blog/2016/test-blog-entry-two.html'),
+ $this->tmpPath('build_local/blog/2016/test-blog-entry-two/index.html'),
+ '',
+ true
+ );
+ }
+
+ /**
+ * Written for issue #152
+ * @link https://github.com/carbontwelve/tapestry/issues/152
+ */
+ public function testIgnoreUnderscorePaths()
+ {
+ $this->loadToTmp($this->assetPath('build_test_30/src'));
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileNotExists($this->tmpPath('build_local/_should-not-exist/index.html'));
+ $this->assertFileExists($this->tmpPath('build_local/should-exist/index.html'));
+ $this->assertFileNotExists($this->tmpPath('build_local/should-exist/_should-not-exist/index.html'));
+ }
+
+ /**
+ * Written for issue #158
+ * @link https://github.com/carbontwelve/tapestry/issues/158
+ */
+ public function testFileTemplatePassThrough()
+ {
+ $this->loadToTmp($this->assetPath('build_test_31/src'));
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_31/check/single.html'),
+ $this->tmpPath('build_local/single/index.html'),
+ '',
+ true
+ );
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_31/check/base.html'),
+ $this->tmpPath('build_local/base/index.html'),
+ '',
+ true
+ );
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_31/check/blog.html'),
+ $this->tmpPath('build_local/blog/2016/test/index.html'),
+ '',
+ true
+ );
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_31/check/page.html'),
+ $this->tmpPath('build_local/page/index.html'),
+ '',
+ true
+ );
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_31/check/page-multi.html'),
+ $this->tmpPath('build_local/page-multi/index.html'),
+ '',
+ true
+ );
+ }
+
+ /**
+ * Written for issue #208
+ * @link https://github.com/carbontwelve/tapestry/issues/208
+ */
+ public function testDoubleDotFileExt()
+ {
+ $this->loadToTmp($this->assetPath('build_test_35/src'));
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals('', trim($output->getDisplay()));
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileNotExists($this->tmpPath('build_local/css/main-min.css'));
+ $this->assertFileExists($this->tmpPath('build_local/css/main.min.css'));
+
+ $this->assertFileNotExists($this->tmpPath('build_local/abc-123-xyz.html'));
+ $this->assertFileExists($this->tmpPath('build_local/abc.123.xyz.html'));
+ }
+
+ /**
+ * Written for issue #156
+ * @link https://github.com/carbontwelve/tapestry/issues/156
+ */
+ public function testPermalinkClashes()
+ {
+ $this->loadToTmp($this->assetPath('build_test_36/src'));
+ $output = $this->runCommand('build', '', ['verbosity' => OutputInterface::VERBOSITY_NORMAL]);
+
+ $this->assertTrue(strpos(trim($output->getDisplay()), 'The permalink [/file-clash.html] is already in use!') !== false);
+ $this->assertEquals(1, $output->getStatusCode());
+ }
+
+ /**
+ * Written for issue #255
+ * @link https://github.com/tapestry-cloud/tapestry/issues/255
+ */
+ public function testPermalinkClashesOnStatic()
+ {
+ $this->loadToTmp($this->assetPath('build_test_39/src'));
+ $output = $this->runCommand('build', '');
+
+ $this->assertEquals(0, $output->getStatusCode());
+ }
+}
diff --git a/tests/ConfigurationTest.php b/tests/Feature/ConfigurationTest.php
similarity index 67%
rename from tests/ConfigurationTest.php
rename to tests/Feature/ConfigurationTest.php
index 6a0a996..e306393 100644
--- a/tests/ConfigurationTest.php
+++ b/tests/Feature/ConfigurationTest.php
@@ -1,21 +1,22 @@
copyDirectory('assets/build_test_14/src', '_tmp');
-
+ $this->loadToTmp($this->assetPath('build_test_14/src'));
$output = $this->runCommand('build', '--quiet');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_14/check/default_index.html',
- __DIR__.'/_tmp/build_local/index.html',
+ $this->assetPath('build_test_14/check/default_index.html'),
+ $this->tmpPath('build_local/index.html'),
'',
true
);
@@ -23,16 +24,15 @@ public function testEnvironmentConfigurationDefault()
public function testEnvironmentConfigurationWithEnvSet()
{
- $this->copyDirectory('assets/build_test_14/src', '_tmp');
-
+ $this->loadToTmp($this->assetPath('build_test_14/src'));
$output = $this->runCommand('build', '--quiet --env=development');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_14/check/development_index.html',
- __DIR__.'/_tmp/build_development/index.html',
+ $this->assetPath('build_test_14/check/development_index.html'),
+ $this->tmpPath('build_development/index.html'),
'',
true
);
@@ -43,16 +43,15 @@ public function testEnvironmentConfigurationWithEnvSet()
*/
public function testYAMLConfigurationDefault()
{
- $this->copyDirectory('assets/build_test_26/src', '_tmp');
-
+ $this->loadToTmp($this->assetPath('build_test_26/src'));
$output = $this->runCommand('build', '--quiet');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_26/check/index.html',
- __DIR__.'/_tmp/build_local/index.html',
+ $this->assetPath('build_test_26/check/index.html'),
+ $this->tmpPath('build_local/index.html'),
'',
true
);
@@ -63,16 +62,15 @@ public function testYAMLConfigurationDefault()
*/
public function testYAMLEnvironmentConfigurationWithEnvSet()
{
- $this->copyDirectory('assets/build_test_26/src', '_tmp');
-
+ $this->loadToTmp($this->assetPath('build_test_26/src'));
$output = $this->runCommand('build', '--quiet --env=development');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_26/check/development_index.html',
- __DIR__.'/_tmp/build_development/index.html',
+ $this->assetPath('build_test_26/check/development_index.html'),
+ $this->tmpPath('build_development/index.html'),
'',
true
);
@@ -86,7 +84,7 @@ public function testYAMLEnvironmentConfigurationWithEnvSet()
*/
public function testYAMLandPHPConfigurationThrowsError()
{
- $this->copyDirectory('assets/build_test_27/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_27/src'));
$this->runCommand('build', '--quiet');
}
@@ -95,7 +93,7 @@ public function testYAMLandPHPConfigurationThrowsError()
*/
public function testYAMLandPHPConfigurationWithEnvSetThrowsError()
{
- $this->copyDirectory('assets/build_test_27/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_27/src'));
$this->runCommand('build', '--quiet --env=development');
}
}
diff --git a/tests/Feature/ContentTypeTest.php b/tests/Feature/ContentTypeTest.php
new file mode 100644
index 0000000..e315a15
--- /dev/null
+++ b/tests/Feature/ContentTypeTest.php
@@ -0,0 +1,54 @@
+loadToTmp($this->assetPath('build_test_16/src'));
+ $output = $this->runCommand('build', '--quiet');
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_16/check/index.html'),
+ $this->tmpPath('build_local/index.html'),
+ '',
+ true
+ );
+ }
+
+ public function testPreviousNextOrder()
+ {
+ $this->loadToTmp($this->assetPath('build_test_18/src'));
+ $output = $this->runCommand('build', '--quiet');
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_18/check/first-post.html'),
+ $this->tmpPath('build_local/blog/2015/first-post/index.html'),
+ '',
+ true
+ );
+ $this->assertFileEquals(
+ $this->assetPath('build_test_18/check/second-post.html'),
+ $this->tmpPath('build_local/blog/2015/second-post/index.html'),
+ '',
+ true
+ );
+ $this->assertFileEquals(
+ $this->assetPath('build_test_18/check/third-post.html'),
+ $this->tmpPath('build_local/blog/2015/third-post/index.html'),
+ '',
+ true
+ );
+ $this->assertFileEquals(
+ $this->assetPath('build_test_18/check/fourth-post.html'),
+ $this->tmpPath('build_local/blog/2015/fourth-post/index.html'),
+ '',
+ true
+ );
+ }
+}
diff --git a/tests/CopyTest.php b/tests/Feature/CopyTest.php
similarity index 58%
rename from tests/CopyTest.php
rename to tests/Feature/CopyTest.php
index f888e78..eb78642 100644
--- a/tests/CopyTest.php
+++ b/tests/Feature/CopyTest.php
@@ -1,15 +1,8 @@
loadToTmp($this->assetPath('build_test_1/src'));
+ $output = $this->runCommand('build', '--quiet --json');
+
+ $this->assertEquals(0, $output->getStatusCode());
+ $this->assertFileExists($this->tmpPath('db.json'));
+ }
+
+ public function testNoWriteBuildFlag()
+ {
+ $this->loadToTmp($this->assetPath('build_test_1/src'));
+ $output = $this->runCommand('build', '--quiet --json --no-write');
+
+ $this->assertEquals(0, $output->getStatusCode());
+ $this->assertFileExists($this->tmpPath('db.json'));
+ $this->assertFileNotExists($this->tmpPath('build_local'));
+ }
+}
diff --git a/tests/KernelTest.php b/tests/Feature/KernelTest.php
similarity index 72%
rename from tests/KernelTest.php
rename to tests/Feature/KernelTest.php
index e4f65ba..05011bc 100644
--- a/tests/KernelTest.php
+++ b/tests/Feature/KernelTest.php
@@ -1,12 +1,13 @@
copyDirectory('assets/build_test_8/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_8/src'));
$output = $this->runCommand('build', '--quiet');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_8/check/boot.html',
- __DIR__.'/_tmp/build_local/boot.html',
+ $this->assetPath('build_test_8/check/boot.html'),
+ $this->tmpPath('build_local/boot.html'),
'',
true
);
$this->assertFileEquals(
- __DIR__.'/assets/build_test_8/check/register.html',
- __DIR__.'/_tmp/build_local/register.html',
+ $this->assetPath('build_test_8/check/register.html'),
+ $this->tmpPath('build_local/register.html'),
'',
true
);
@@ -40,15 +41,15 @@ public function testKernelInterfaceMethodsUsed()
public function testSiteKernelLoading()
{
- $this->copyDirectory('assets/build_test_28/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_28/src'));
$output = $this->runCommand('build', '--quiet');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_28/check/index.html',
- __DIR__.'/_tmp/build_local/index.html',
+ $this->assetPath('build_test_28/check/index.html'),
+ $this->tmpPath('build_local/index.html'),
'',
true
);
@@ -60,7 +61,7 @@ public function testSiteKernelLoading()
*/
public function testLoadingCommandViaSiteKernelBoot()
{
- $this->copyDirectory('assets/build_test_10/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_10/src'));
$output = $this->runCommand('hello');
$this->assertEquals('Hello world! This command was loaded via a site Kernel.', trim($output->getDisplay()));
@@ -75,9 +76,9 @@ public function testLoadingCommandViaSiteKernelBoot()
*/
public function testKernelThrowsException()
{
- $this->copyDirectory('assets/build_test_37/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_37/src'));
$class = new ProjectKernelServiceProvider();
- $tapestry = $this->mockTapestry(__DIR__ . DIRECTORY_SEPARATOR . '_tmp');
+ $tapestry = $this->mockTapestry($this->tmpPath());
$class->setContainer($tapestry->getContainer());
$this->expectExceptionMessage('[SiteThirtySeven\Kernel] kernel file not found.');
@@ -90,9 +91,9 @@ public function testKernelThrowsException()
*/
public function testKernelCaseLoaded()
{
- $this->copyDirectory('assets/build_test_38/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_38/src'));
$class = new ProjectKernelServiceProvider();
- $tapestry = $this->mockTapestry(__DIR__ . DIRECTORY_SEPARATOR . '_tmp');
+ $tapestry = $this->mockTapestry($this->tmpPath());
$class->setContainer($tapestry->getContainer());
$class->boot();
diff --git a/tests/LockFileTest.php b/tests/Feature/LockFileTest.php
similarity index 64%
rename from tests/LockFileTest.php
rename to tests/Feature/LockFileTest.php
index f1c908f..556b036 100644
--- a/tests/LockFileTest.php
+++ b/tests/Feature/LockFileTest.php
@@ -1,8 +1,10 @@
copyDirectory('assets/build_test_40/src', '_tmp');
- $lock = fopen(__DIR__ . DIRECTORY_SEPARATOR . '_tmp' . DIRECTORY_SEPARATOR . '.lock', 'w+');
+ $this->loadToTmp($this->assetPath('build_test_40/src'));
+ $lock = fopen($this->tmpPath('.lock'), 'w+');
$this->assertTrue(flock($lock, LOCK_EX | LOCK_NB));
$output = $this->runCommand('build', '');
$this->assertEquals(1, $output->getStatusCode());
+ fclose($lock);
}
/**
@@ -24,7 +27,8 @@ public function testLockFileKillsTask()
*/
public function testIgnoringLockFile()
{
- $this->copyDirectory('assets/build_test_40/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_40/src'));
+ touch($this->tmpPath('.lock'));
$output = $this->runCommand('build', '--no-lock');
$this->assertEquals(0, $output->getStatusCode());
}
diff --git a/tests/MarkdownLayoutTest.php b/tests/Feature/MarkdownLayoutTest.php
similarity index 53%
rename from tests/MarkdownLayoutTest.php
rename to tests/Feature/MarkdownLayoutTest.php
index babd953..3aaf34d 100644
--- a/tests/MarkdownLayoutTest.php
+++ b/tests/Feature/MarkdownLayoutTest.php
@@ -1,18 +1,20 @@
copyDirectory('assets/build_test_19/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_19/src'));
$output = $this->runCommand('build', '--quiet');
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_19/check/test.html',
- __DIR__.'/_tmp/build_local/test/index.html',
+ $this->assetPath('build_test_19/check/test.html'),
+ $this->tmpPath('build_local/test/index.html'),
'',
true
);
@@ -20,13 +22,13 @@ public function testMarkdownFilesGetRenderedInLayouts()
public function testMarkdownFilesGetRenderedInChildLayouts()
{
- $this->copyDirectory('assets/build_test_20/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_20/src'));
$output = $this->runCommand('build', '--quiet');
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_20/check/test.html',
- __DIR__.'/_tmp/build_local/test/index.html',
+ $this->assetPath('build_test_20/check/test.html'),
+ $this->tmpPath('build_local/test/index.html'),
'',
true
);
diff --git a/tests/Feature/PaginationGeneratorTest.php b/tests/Feature/PaginationGeneratorTest.php
new file mode 100644
index 0000000..f478f5d
--- /dev/null
+++ b/tests/Feature/PaginationGeneratorTest.php
@@ -0,0 +1,40 @@
+loadToTmp($this->assetPath('build_test_17/src'));
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals(0, $output->getStatusCode());
+ $this->assertFileExists($this->tmpPath('build_local/blog/index.html'));
+ $this->assertFileExists($this->tmpPath('build_local/blog/2/index.html'));
+ }
+
+ public function testPaginationNextPrevious()
+ {
+ $this->loadToTmp($this->assetPath('build_test_17/src'));
+ $output = $this->runCommand('build', '--quiet');
+
+ $this->assertEquals(0, $output->getStatusCode());
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_17/check/1.html'),
+ $this->tmpPath('build_local/blog/index.html'),
+ '',
+ true
+ );
+
+ $this->assertFileEquals(
+ $this->assetPath('build_test_17/check/2.html'),
+ $this->tmpPath('build_local/blog/2/index.html'),
+ '',
+ true
+ );
+ }
+}
diff --git a/tests/PermalinkTest.php b/tests/Feature/PermalinkTest.php
similarity index 76%
rename from tests/PermalinkTest.php
rename to tests/Feature/PermalinkTest.php
index 6c9c992..07ee99b 100644
--- a/tests/PermalinkTest.php
+++ b/tests/Feature/PermalinkTest.php
@@ -1,22 +1,19 @@
assertEquals('/category1/category2/category3/test-md-post/index.html', $this->setupPermalinks($this->setupFile(__DIR__ . '/Mocks/TestCategoryPermalinkTag.md')));
+ $this->assertEquals('/category1/category2/category3/test-md-post/index.html', $this->setupPermalinks($this->setupFile(__DIR__ . '/../Mocks/TestCategoryPermalinkTag.md')));
// Full Test
- $this->copyDirectory('assets/build_test_33/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_33/src'));
$output = $this->runCommand('build', '--quiet --json');
$this->assertEquals(0, $output->getStatusCode());
- $this->assertFileExists(__DIR__ . '/_tmp/build_local/blog/2016/category-1/category-iii/category-two/test/index.html');
+ $this->assertFileExists($this->tmpPath('build_local/blog/2016/category-1/category-iii/category-two/test/index.html'));
}
/**
@@ -58,18 +56,18 @@ public function testCategoryPermalinkTag()
*/
public function testCategoryPermalinkTagWithLimit()
{
- $this->assertEquals('/category1/test-md-post/index.html', $this->setupPermalinks($this->setupFile(__DIR__ . '/mocks/TestCategoryPermalinkTagLimitOne.md')));
- $this->assertEquals('/category1/category2/test-md-post/index.html', $this->setupPermalinks($this->setupFile(__DIR__ . '/mocks/TestCategoryPermalinkTagLimitTwo.md')));
+ $this->assertEquals('/category1/test-md-post/index.html', $this->setupPermalinks($this->setupFile(__DIR__ . '/../mocks/TestCategoryPermalinkTagLimitOne.md')));
+ $this->assertEquals('/category1/category2/test-md-post/index.html', $this->setupPermalinks($this->setupFile(__DIR__ . '/../mocks/TestCategoryPermalinkTagLimitTwo.md')));
}
public function testPrettyPermalink()
{
- $this->assertEquals('/testfile/index.md', $this->setupPermalinks($this->setupFile(__DIR__ . '/Mocks/TestFile.md')));
+ $this->assertEquals('/testfile/index.md', $this->setupPermalinks($this->setupFile(__DIR__ . '/../Mocks/TestFile.md')));
}
public function testPermalinkPathSlashes()
{
- $file = $this->setupFile(__DIR__ . '/Mocks/TestFile.md');
+ $file = $this->setupFile(__DIR__ . '/../Mocks/TestFile.md');
$backSlashTest = $file;
$backSlashTest->setPath('hello\\world/123');
diff --git a/tests/TaxonomyArchiveGeneratorTest.php b/tests/Feature/TaxonomyArchiveGeneratorTest.php
similarity index 89%
rename from tests/TaxonomyArchiveGeneratorTest.php
rename to tests/Feature/TaxonomyArchiveGeneratorTest.php
index b18f022..d6943d2 100644
--- a/tests/TaxonomyArchiveGeneratorTest.php
+++ b/tests/Feature/TaxonomyArchiveGeneratorTest.php
@@ -1,7 +1,8 @@
copyDirectory('assets/build_test_23/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_23/src'));
//
$definitions = new DefaultInputDefinition();
$tapestry = new Tapestry(new ArrayInput([
- '--site-dir' => __DIR__ . DIRECTORY_SEPARATOR . '_tmp',
+ '--site-dir' => $this->tmpPath(),
'--env' => 'testing'
], $definitions));
$generator = new Generator($tapestry->getContainer()->get('Compile.Steps'), $tapestry);
diff --git a/tests/UnPublishDraftsTest.php b/tests/Feature/UnPublishDraftsTest.php
similarity index 53%
rename from tests/UnPublishDraftsTest.php
rename to tests/Feature/UnPublishDraftsTest.php
index 644237e..7f62cb7 100644
--- a/tests/UnPublishDraftsTest.php
+++ b/tests/Feature/UnPublishDraftsTest.php
@@ -1,8 +1,10 @@
copyDirectory('assets/build_test_12/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_12/src'));
$output = $this->runCommand('build', '--quiet --auto-publish');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
- $this->assertFileExists(__DIR__.'/_tmp/build_local/blog/2016/test-blog-entry-two/index.html');
+ $this->assertFileExists($this->tmpPath('build_local/blog/2016/test-blog-entry-two/index.html'));
}
/**
* Test that setting draft to true in a blog posts front matter ensures that it is not published.
*/
- public function testUnpublishDrafts()
+ public function testUnPublishDrafts()
{
- $this->copyDirectory('assets/build_test_12/src', '_tmp');
-
+ $this->loadToTmp($this->assetPath('build_test_12/src'));
$output = $this->runCommand('build', '--quiet');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_12/check/blog/2016/test-blog-entry.html',
- __DIR__.'/_tmp/build_local/blog/2016/test-blog-entry/index.html',
+ $this->assetPath('build_test_12/check/blog/2016/test-blog-entry.html'),
+ $this->tmpPath('build_local/blog/2016/test-blog-entry/index.html'),
'',
true
);
- $this->assertFileNotExists(__DIR__.'/_tmp/build_local/blog/2016/test-blog-entry-two/index.html');
- $this->assertFileNotExists(__DIR__.'/_tmp/build_local/blog/2116/test-blog-entry-three/index.html');
+ $this->assertFileNotExists($this->tmpPath('build_local/blog/2016/test-blog-entry-two/index.html'));
+ $this->assertFileNotExists($this->tmpPath('build_local/blog/2116/test-blog-entry-three/index.html'));
}
/**
@@ -48,23 +49,22 @@ public function testUnpublishDrafts()
*/
public function testPublishDraftsConfigurationOverride()
{
- $this->copyDirectory('assets/build_test_13/src', '_tmp');
-
+ $this->loadToTmp($this->assetPath('build_test_13/src'));
$output = $this->runCommand('build', '--quiet');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_13/check/blog/2016/test-blog-entry.html',
- __DIR__.'/_tmp/build_local/blog/2016/test-blog-entry/index.html',
+ $this->assetPath('build_test_13/check/blog/2016/test-blog-entry.html'),
+ $this->tmpPath('build_local/blog/2016/test-blog-entry/index.html'),
'',
true
);
$this->assertFileEquals(
- __DIR__.'/assets/build_test_13/check/blog/2016/test-blog-entry-two.html',
- __DIR__.'/_tmp/build_local/blog/2016/test-blog-entry-two/index.html',
+ $this->assetPath('build_test_13/check/blog/2016/test-blog-entry-two.html'),
+ $this->tmpPath('build_local/blog/2016/test-blog-entry-two/index.html'),
'',
true
);
diff --git a/tests/ViewFileTraitTest.php b/tests/Feature/ViewFileTraitTest.php
similarity index 84%
rename from tests/ViewFileTraitTest.php
rename to tests/Feature/ViewFileTraitTest.php
index 0440c18..68b7e15 100644
--- a/tests/ViewFileTraitTest.php
+++ b/tests/Feature/ViewFileTraitTest.php
@@ -1,33 +1,34 @@
copyDirectory('assets/build_test_15/src', '_tmp');
+ $this->loadToTmp($this->assetPath('build_test_15/src'));
$output = $this->runCommand('build', '--quiet');
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__.'/assets/build_test_15/check/draft-true.html',
- __DIR__.'/_tmp/build_local/draft-true.html',
+ $this->assetPath('build_test_15/check/draft-true.html'),
+ $this->tmpPath('build_local/draft-true.html'),
'',
true
);
$this->assertFileEquals(
- __DIR__.'/assets/build_test_15/check/draft-false.html',
- __DIR__.'/_tmp/build_local/draft-false.html',
+ $this->assetPath('build_test_15/check/draft-false.html'),
+ $this->tmpPath('build_local/draft-false.html'),
'',
true
);
@@ -39,7 +40,7 @@ public function testIsDraftHelper()
*/
public function testExcerptHelper()
{
- $viewFile = $this->mockViewFile($this->mockTapestry(),__DIR__ . '/Mocks/TestExcerptFile.md');
+ $viewFile = $this->mockViewFile($this->mockTapestry(),__DIR__ . '/../Mocks/TestExcerptFile.md');
$this->assertEquals('Lorem ipsum dolor sit amet, consectetur…', $viewFile->getExcerpt());
$this->assertEquals('Lorem ipsum dolor sit amet, consectetur', $viewFile->getExcerpt(50, ''));
@@ -49,13 +50,13 @@ public function testExcerptHelper()
$this->assertEquals('Lorem', $viewFile->getExcerpt(10, ''));
$this->assertEquals('Lorem', $viewFile->getExcerpt(10, null));
- $viewFile = $this->mockViewFile($this->mockTapestry(),__DIR__ . '/Mocks/TestFile.md');
+ $viewFile = $this->mockViewFile($this->mockTapestry(),__DIR__ . '/../Mocks/TestFile.md');
$this->assertEquals('This is a test file...', $viewFile->getExcerpt(50, null));
}
public function testGetContentHelper()
{
- $viewFile = $this->mockViewFile($this->mockTapestry(),__DIR__ . '/Mocks/TestFile.md');
+ $viewFile = $this->mockViewFile($this->mockTapestry(),__DIR__ . '/../Mocks/TestFile.md');
$this->assertEquals('This is a test file...', trim($viewFile->getContent()));
$viewFile->getFile()->setData(['content' => 'TEST test TEST 1234']);
@@ -64,7 +65,7 @@ public function testGetContentHelper()
public function testGetPermalinkHelper()
{
- $viewFile = $this->mockViewFile($this->mockTapestry(),__DIR__ . '/Mocks/TestExcerptFile.md');
+ $viewFile = $this->mockViewFile($this->mockTapestry(),__DIR__ . '/../Mocks/TestExcerptFile.md');
$this->assertEquals('/testexcerptfile/index.md', $viewFile->getPermalink()); // this has the extension md becuase its not passed through any renderers
$viewFile->getFile()->setData(['permalink' => '/folder1/folder2/folder3/test.html']);
@@ -75,7 +76,7 @@ public function testGetUrlHelper()
{
$viewFile = $this->mockViewFile(
$this->mockTapestry(null, ['site' => ['url' => 'http://www.example.com']]),
- __DIR__ . '/Mocks/TestExcerptFile.md'
+ __DIR__ . '/../Mocks/TestExcerptFile.md'
);
$this->assertEquals('http://www.example.com/testexcerptfile/', $viewFile->getUrl());
@@ -88,7 +89,7 @@ public function testIsPaginatedHelper()
{
$viewFile = $this->mockViewFile(
$this->mockTapestry(null, ['site' => ['url' => 'http://www.example.com']]),
- __DIR__ . '/Mocks/TestExcerptFile.md'
+ __DIR__ . '/../Mocks/TestExcerptFile.md'
);
$this->assertEquals(false, $viewFile->isPaginated());
@@ -104,7 +105,7 @@ public function testHasPreviousNextHelper()
{
$viewFile = $this->mockViewFile(
$this->mockTapestry(null, ['site' => ['url' => 'http://www.example.com']]),
- __DIR__ . '/Mocks/TestExcerptFile.md'
+ __DIR__ . '/../Mocks/TestExcerptFile.md'
);
$this->assertEquals(false, $viewFile->hasPreviousNext());
@@ -120,7 +121,7 @@ public function testGetDateHelper()
{
$viewFile = $this->mockViewFile(
$this->mockTapestry(),
- __DIR__ . '/Mocks/TestFile.md'
+ __DIR__ . '/../Mocks/TestFile.md'
);
$this->assertInstanceOf(\DateTime::class, $viewFile->getDate());
diff --git a/tests/FileTest.php b/tests/FileTest.php
deleted file mode 100644
index 198e897..0000000
--- a/tests/FileTest.php
+++ /dev/null
@@ -1,15 +0,0 @@
-assertNotEmpty($file->getUid());
- }
-}
diff --git a/tests/JsonApiTest.php b/tests/JsonApiTest.php
deleted file mode 100644
index db96bb8..0000000
--- a/tests/JsonApiTest.php
+++ /dev/null
@@ -1,23 +0,0 @@
-copyDirectory('assets/build_test_1/src', '_tmp');
- $output = $this->runCommand('build', '--quiet --json');
- $this->assertEquals(0, $output->getStatusCode());
- $this->assertFileExists(__DIR__ . '/_tmp/db.json');
- }
-
- public function testNoWriteBuildFlag()
- {
- $this->copyDirectory('assets/build_test_1/src', '_tmp');
- $output = $this->runCommand('build', '--quiet --json --no-write');
- $this->assertEquals(0, $output->getStatusCode());
- $this->assertFileExists(__DIR__ . '/_tmp/db.json');
- $this->assertFileNotExists(__DIR__ . '/_tmp/build_local');
- }
-}
diff --git a/tests/MockArrayAccessByKeyClass.php b/tests/Mocks/MockArrayAccessByKeyClass.php
similarity index 90%
rename from tests/MockArrayAccessByKeyClass.php
rename to tests/Mocks/MockArrayAccessByKeyClass.php
index a7f7f9b..fde203a 100644
--- a/tests/MockArrayAccessByKeyClass.php
+++ b/tests/Mocks/MockArrayAccessByKeyClass.php
@@ -1,6 +1,6 @@
copyDirectory('assets/build_test_17/src', '_tmp');
- $output = $this->runCommand('build', '--quiet');
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileExists(__DIR__.'/_tmp/build_local/blog/index.html');
- $this->assertFileExists(__DIR__.'/_tmp/build_local/blog/2/index.html');
- }
-
- public function testPaginationNextPrevious()
- {
- $this->copyDirectory('assets/build_test_17/src', '_tmp');
- $output = $this->runCommand('build', '--quiet');
- $this->assertEquals(0, $output->getStatusCode());
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_17/check/1.html',
- __DIR__.'/_tmp/build_local/blog/index.html',
- '',
- true
- );
-
- $this->assertFileEquals(
- __DIR__.'/assets/build_test_17/check/2.html',
- __DIR__.'/_tmp/build_local/blog/2/index.html',
- '',
- true
- );
- }
-}
diff --git a/tests/TestCase.php b/tests/TestCase.php
new file mode 100644
index 0000000..a499d83
--- /dev/null
+++ b/tests/TestCase.php
@@ -0,0 +1,205 @@
+tmpDirectory = sys_get_temp_dir() . DIRECTORY_SEPARATOR . '_tapestry_tmp_' . sha1(microtime());
+ while(file_exists($this->tmpDirectory)){
+ $this->tmpDirectory = sys_get_temp_dir() . DIRECTORY_SEPARATOR . '_tapestry_tmp_' . sha1(microtime());
+ }
+ mkdir($this->tmpDirectory);
+ chdir($this->tmpDirectory);
+ }
+
+ /**
+ * Called after each test is executed.
+ */
+ protected function tearDown()
+ {
+ $it = new RecursiveDirectoryIterator($this->tmpDirectory, RecursiveDirectoryIterator::SKIP_DOTS);
+ $files = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
+ foreach($files as $file) {
+ if ($file->isDir()){
+ rmdir($file->getRealPath());
+ } else {
+ unlink($file->getRealPath());
+ }
+ }
+ chdir(__DIR__);
+ rmdir($this->tmpDirectory);
+
+ // Because the configureIo method of Symfony's command Application pollutes the globals they need resetting
+ // between each test.
+ putenv('SHELL_VERBOSITY=0');
+ unset($_ENV['SHELL_VERBOSITY']);
+ unset($_SERVER['SHELL_VERBOSITY']);
+ }
+
+ /**
+ * Copy a file.
+ *
+ * @param string $origin
+ * @param string $destination
+ * @param bool $overwrite
+ * @return void
+ */
+ protected function copy($origin, $destination, $overwrite = false)
+ {
+ (new Filesystem())->copy($origin, $destination, $overwrite);
+ }
+
+ /**
+ * Mirror $origin to $destination.
+ *
+ * @param string $origin
+ * @param string $destination
+ * @return void
+ */
+ protected function mirror($origin, $destination)
+ {
+ (new Filesystem())->mirror($origin, $destination);
+ }
+
+ /**
+ * Load a source folder into tmp.
+ *
+ * @param string $source
+ */
+ protected function loadToTmp($source)
+ {
+ $this->mirror($source, $this->tmpDirectory);
+ }
+
+ /**
+ * Helper for building tmp paths.
+ *
+ * @param null|string $path
+ * @return string
+ */
+ protected function tmpPath($path = null) {
+ if (is_null($path)) {
+ return $this->tmpDirectory;
+ }
+
+ if (! in_array(substr($path, 0, 1), ['/', '\\'])) {
+ return $this->tmpDirectory . DIRECTORY_SEPARATOR . $path;
+ }
+
+ return $this->tmpDirectory . $path;
+ }
+
+ /**
+ * Helper for building asset paths.
+ *
+ * @param null|string $path
+ * @return string
+ */
+ protected function assetPath($path = null) {
+ if (is_null($path)) {
+ return realpath(__DIR__ . '/assets');
+ }
+
+ if (! in_array(substr($path, 0, 1), ['/', '\\'])) {
+ return realpath(__DIR__ . '/assets') . DIRECTORY_SEPARATOR . $path;
+ }
+
+ return realpath(__DIR__ . '/assets') . $path;
+ }
+
+ /**
+ * Run command line command.
+ *
+ * @param string $command
+ * @param string $argv
+ * @param array $options
+ * @return ApplicationTester
+ */
+ protected function runCommand($command, $argv = '', array $options = [])
+ {
+ $arguments = ['command' => $command];
+ $argv = (strlen($argv) > 0) ? explode(' ', $argv) : [];
+
+ foreach ($argv as $value) {
+ if (strpos($value, '=') !== false) {
+ $tmp = explode('=', $value);
+ $arguments[$tmp[0]] = $tmp[1];
+ continue;
+ }
+ $arguments[$value] = true;
+ }
+ unset($tmp, $value);
+ array_unshift($argv, $command);
+
+ $tapestry = new Tapestry(
+ new Input(
+ $argv,
+ new DefaultInputDefinition()
+ )
+ );
+
+ /** @var Application $cli */
+ $cli = $tapestry[Application::class];
+ $cli->setAutoExit(false);
+
+
+
+ $applicationTester = new ApplicationTester($cli);
+ $applicationTester->run($arguments, $options);
+
+ return $applicationTester;
+ }
+
+ /**
+ * Asserts that the contents of one file is equal to the contents of another
+ * file.
+ *
+ * @param string $expected
+ * @param string $actual
+ * @param string $message
+ * @param bool $canonicalize
+ * @param bool $ignoreCase
+ *
+ * @since Method available since Release 3.2.14
+ */
+ public static function assertFileEquals(
+ $expected,
+ $actual,
+ $message = '',
+ $canonicalize = false,
+ $ignoreCase = false
+ ) {
+ self::assertFileExists($expected, $message);
+ self::assertFileExists($actual, $message);
+ self::assertEquals(
+ preg_replace('~\R~u', "\r\n", trim(file_get_contents($expected))),
+ preg_replace('~\R~u', "\r\n", trim(file_get_contents($actual))),
+ $message,
+ 0,
+ 10,
+ $canonicalize,
+ $ignoreCase
+ );
+ }
+}
\ No newline at end of file
diff --git a/tests/ArrayContainerMergeTest.php b/tests/Unit/ArrayContainerMergeTest.php
similarity index 97%
rename from tests/ArrayContainerMergeTest.php
rename to tests/Unit/ArrayContainerMergeTest.php
index 1330656..c4a1a4f 100644
--- a/tests/ArrayContainerMergeTest.php
+++ b/tests/Unit/ArrayContainerMergeTest.php
@@ -1,10 +1,12 @@
copy(
- __DIR__ . DIRECTORY_SEPARATOR . '/assets/cache_files/.local_cache.1.0.8',
- __DIR__ . DIRECTORY_SEPARATOR . '/_tmp/.local_cache',
+ $this->copy(
+ __DIR__ . DIRECTORY_SEPARATOR . '/../assets/cache_files/.local_cache.1.0.8',
+ $this->tmpDirectory . DIRECTORY_SEPARATOR . '/_tmp/.local_cache',
true
);
- $cache = new Cache(__DIR__ . DIRECTORY_SEPARATOR . '/_tmp/.local_cache', '56157ae56f3acd71dd81a2d09e7582399c661599');
+ $cache = new Cache($this->tmpDirectory . DIRECTORY_SEPARATOR . '/.local_cache', '56157ae56f3acd71dd81a2d09e7582399c661599');
$cache->load();
// If this dones't throw an exception then the test has passed.
@@ -45,16 +44,16 @@ public function testCacheStoreValidateTapestryVersionGreaterThan()
$cacheStore = new CacheStore(sha1('Hello world'), '200.100.10');
$cacheStore->setItem('Hello', 'World');
- $cacheA = new Cache(__DIR__ . DIRECTORY_SEPARATOR . '_tmp' . DIRECTORY_SEPARATOR . '.test.cache', sha1('Hello world'));
+ $cacheA = new Cache($this->tmpDirectory . DIRECTORY_SEPARATOR . '.test.cache', sha1('Hello world'));
$cacheA->setCacheStore($cacheStore);
$this->assertEquals('World', $cacheA->getItem('Hello'));
$cacheA->save();
- $this->assertFileExists(__DIR__ . DIRECTORY_SEPARATOR . '_tmp' . DIRECTORY_SEPARATOR . '.test.cache');
+ $this->assertFileExists($this->tmpDirectory . DIRECTORY_SEPARATOR . '.test.cache');
- $cacheB = new Cache(__DIR__ . DIRECTORY_SEPARATOR . '_tmp' . DIRECTORY_SEPARATOR . '.test.cache', sha1('Hello world'));
+ $cacheB = new Cache($this->tmpDirectory . DIRECTORY_SEPARATOR . '.test.cache', sha1('Hello world'));
$this->expectException(InvalidVersionException::class);
$cacheB->load();
@@ -70,16 +69,16 @@ public function testCacheStoreValidateTapestryVersionLessThan()
$cacheStore = new CacheStore(sha1('Hello world'), '1.0.0');
$cacheStore->setItem('Hello', 'World');
- $cacheA = new Cache(__DIR__ . DIRECTORY_SEPARATOR . '_tmp' . DIRECTORY_SEPARATOR . '.test.cache', sha1('Hello world'));
+ $cacheA = new Cache($this->tmpDirectory . DIRECTORY_SEPARATOR . '.test.cache', sha1('Hello world'));
$cacheA->setCacheStore($cacheStore);
$this->assertEquals('World', $cacheA->getItem('Hello'));
$cacheA->save();
- $this->assertFileExists(__DIR__ . DIRECTORY_SEPARATOR . '_tmp' . DIRECTORY_SEPARATOR . '.test.cache');
+ $this->assertFileExists($this->tmpDirectory. DIRECTORY_SEPARATOR . '.test.cache');
- $cacheB = new Cache(__DIR__ . DIRECTORY_SEPARATOR . '_tmp' . DIRECTORY_SEPARATOR . '.test.cache', sha1('Hello world'));
+ $cacheB = new Cache($this->tmpDirectory . DIRECTORY_SEPARATOR . '.test.cache', sha1('Hello world'));
$cacheB->load();
}
@@ -142,7 +141,7 @@ public function testCacheStoreReset()
public function testCacheInitialLoad()
{
$hashA = sha1('Hello World');
- $cache = new Cache(__DIR__ . '/_tmp/cache.bin', $hashA);
+ $cache = new Cache($this->tmpDirectory . DIRECTORY_SEPARATOR . 'cache.bin', $hashA);
$cache->load();
$this->assertEquals(0, $cache->count());
@@ -151,7 +150,7 @@ public function testCacheInitialLoad()
public function testCacheSaveAndLoad()
{
$hashA = sha1('Hello World');
- $cache = new Cache(__DIR__ . '/_tmp/cache.bin', $hashA);
+ $cache = new Cache($this->tmpDirectory . '/cache.bin', $hashA);
$cache->setItem('A', 'B');
$cache->setItem('B', 'C');
@@ -162,7 +161,7 @@ public function testCacheSaveAndLoad()
$cache->save();
- $cache = new Cache(__DIR__ . '/_tmp/cache.bin', $hashA);
+ $cache = new Cache($this->tmpDirectory . '/cache.bin', $hashA);
$this->assertEquals(0, $cache->count());
$cache->load();
$this->assertEquals(4, $cache->count());
@@ -177,7 +176,7 @@ public function testCacheSaveAndLoad()
public function testCacheReset()
{
$hashA = sha1('Hello World');
- $cache = new Cache(__DIR__ . '/_tmp/cache.bin', $hashA);
+ $cache = new Cache($this->tmpDirectory . '/cache.bin', $hashA);
$cache->setItem('A', 'B');
$this->assertEquals(1, $cache->count());
$cache->reset();
@@ -188,7 +187,7 @@ public function testCacheInvalidationByHash()
{
$hashA = sha1('Hello World');
$hashB = sha1('World Hello');
- $cache = new Cache(__DIR__ . '/_tmp/cache.bin', $hashA);
+ $cache = new Cache($this->tmpDirectory . '/cache.bin', $hashA);
$cache->setItem('A', 'B');
$cache->setItem('B', 'C');
@@ -196,17 +195,17 @@ public function testCacheInvalidationByHash()
$cache->save();
- $cache = new Cache(__DIR__ . '/_tmp/cache.bin', $hashB);
+ $cache = new Cache($this->tmpDirectory . '/cache.bin', $hashB);
$cache->load();
$this->assertEquals(0, $cache->count());
}
public function testReadCacheModule()
{
- $this->copyDirectory('/assets/build_test_21/src', '/_tmp');
+ $this->loadToTmp(__DIR__ . '/../assets/build_test_21/src');
$module = new ReadCache(new Finder());
- $project = new Project(__DIR__ . '/_tmp', __DIR__ . '/_tmp/build_test', 'test');
+ $project = new Project($this->tmpDirectory, $this->tmpDirectory . DIRECTORY_SEPARATOR . 'build_test', 'test');
$this->assertEquals(false, $project->has('cache'));
@@ -225,7 +224,7 @@ public function testReadCacheModule()
unset($module, $project);
$module = new ReadCache(new Finder());
- $project = new Project(__DIR__ . '/_tmp', __DIR__ . '/_tmp/build_test', 'test');
+ $project = new Project($this->tmpDirectory, $this->tmpDirectory . DIRECTORY_SEPARATOR . 'build_test', 'test');
$module->__invoke($project, new NullOutput());
$this->assertEquals(2, $project->get('cache')->count());
$this->assertEquals('B', $project->get('cache')->getItem('A'));
@@ -234,41 +233,41 @@ public function testReadCacheModule()
// Reset $module && $project variables and modify the src directory to test cache invalidation
unset($module, $project);
- self::$fileSystem->copy(
- __DIR__ . DIRECTORY_SEPARATOR . '/assets/build_test_21/src_replace/config.php',
- __DIR__ . DIRECTORY_SEPARATOR . '/_tmp/config.php',
+ $this->copy(
+ __DIR__ . '/../assets/build_test_21/src_replace/config.php',
+ $this->tmpDirectory . '/config.php',
true
);
- self::$fileSystem->copy(
- __DIR__ . DIRECTORY_SEPARATOR . '/assets/build_test_21/src_replace/kernel.php',
- __DIR__ . DIRECTORY_SEPARATOR . '/_tmp/kernel.php',
+ $this->copy(
+ __DIR__ . '/../assets/build_test_21/src_replace/kernel.php',
+ $this->tmpDirectory . '/kernel.php',
true
);
$module = new ReadCache(new Finder());
- $project = new Project(__DIR__ . '/_tmp', __DIR__ . '/_tmp/build_test', 'test');
+ $project = new Project($this->tmpDirectory, $this->tmpDirectory . DIRECTORY_SEPARATOR . 'build_test', 'test');
$module->__invoke($project, new NullOutput());
$this->assertEquals(0, $project->get('cache')->count());
}
public function testTemplateModificationInvalidateCacheViaFrontMatter()
{
- $this->copyDirectory('/assets/build_test_22/src', '/_tmp');
+ $this->loadToTmp(__DIR__ . '/../assets/build_test_22/src');
$output = $this->runCommand('build', '--quiet');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__ . '/assets/build_test_22/check/index.html',
- __DIR__ . '/_tmp/build_local/test/index.html',
+ __DIR__ . '/../assets/build_test_22/check/index.html',
+ $this->tmpDirectory. '/build_local/test/index.html',
'',
true
);
- self::$fileSystem->copy(
- __DIR__ . DIRECTORY_SEPARATOR . '/assets/build_test_22/src_replace/page.phtml',
- __DIR__ . DIRECTORY_SEPARATOR . '/_tmp/source/_templates/page.phtml',
+ $this->copy(
+ __DIR__ . '/../assets/build_test_22/src_replace/page.phtml',
+ $this->tmpDirectory . '/source/_templates/page.phtml',
true
);
@@ -276,8 +275,8 @@ public function testTemplateModificationInvalidateCacheViaFrontMatter()
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__ . '/assets/build_test_22/check/index_replace.html',
- __DIR__ . '/_tmp/build_local/test/index.html',
+ __DIR__ . '/../assets/build_test_22/check/index_replace.html',
+ $this->tmpDirectory . '/build_local/test/index.html',
'',
true
);
@@ -285,14 +284,14 @@ public function testTemplateModificationInvalidateCacheViaFrontMatter()
public function testTemplateModificationInvalidateCacheViaPlates()
{
- $this->copyDirectory('/assets/build_test_22/src', '/_tmp');
+ $this->loadToTmp(__DIR__ . '/../assets/build_test_22/src');
$output = $this->runCommand('build', '--quiet');
$this->assertEquals('', trim($output->getDisplay()));
$this->assertEquals(0, $output->getStatusCode());
- self::$fileSystem->copy(
- __DIR__ . DIRECTORY_SEPARATOR . '/assets/build_test_22/src_replace/page.phtml',
- __DIR__ . DIRECTORY_SEPARATOR . '/_tmp/source/_templates/page.phtml',
+ $this->copy(
+ __DIR__ . '/../assets/build_test_22/src_replace/page.phtml',
+ $this->tmpDirectory . '/source/_templates/page.phtml',
true
);
@@ -300,8 +299,8 @@ public function testTemplateModificationInvalidateCacheViaPlates()
$this->assertEquals(0, $output->getStatusCode());
$this->assertFileEquals(
- __DIR__ . '/assets/build_test_22/check/multi-inheritance.html',
- __DIR__ . '/_tmp/build_local/multi-inheritance-test/index.html',
+ __DIR__ . '/../assets/build_test_22/check/multi-inheritance.html',
+ $this->tmpDirectory . '/build_local/multi-inheritance-test/index.html',
'',
true
);
diff --git a/tests/CollectionsTest.php b/tests/Unit/CollectionsTest.php
similarity index 96%
rename from tests/CollectionsTest.php
rename to tests/Unit/CollectionsTest.php
index 1e44fd0..f591d01 100644
--- a/tests/CollectionsTest.php
+++ b/tests/Unit/CollectionsTest.php
@@ -1,11 +1,12 @@
runCommand('', '--version', ['verbosity' => Output::VERBOSITY_NORMAL]);
+ $this->assertEquals('Tapestry version '.Tapestry::VERSION.', environment local', trim($output->getDisplay()));
+ }
+}
diff --git a/tests/Unit/ContentTypeTest.php b/tests/Unit/ContentTypeTest.php
new file mode 100644
index 0000000..686afc9
--- /dev/null
+++ b/tests/Unit/ContentTypeTest.php
@@ -0,0 +1,53 @@
+ true]);
+ $file = new File(new SplFileInfo(__DIR__ . '/../Mocks/TestFile.md', '', ''));
+ $this->assertFalse($file->hasData('contentType'));
+ $contentType->addFile($file);
+ $this->assertTrue($file->hasData('contentType'));
+ }
+
+ /**
+ * Added for issue 87
+ * @see https://github.com/carbontwelve/tapestry/issues/87
+ */
+ public function testContentTypeFactoryArrayAccessByKey()
+ {
+ $contentType = new ContentType('Test', ['enabled' => true]);
+ $contentTypeFactory = new ContentTypeFactory([
+ $contentType
+ ]);
+ $this->assertTrue($contentTypeFactory->has('_Test'));
+ $this->assertEquals($contentType, $contentTypeFactory->arrayAccessByKey('Test'));
+ $this->assertEquals(null, $contentTypeFactory->arrayAccessByKey('NonExistant'));
+ }
+
+ /**
+ * Added for issue 86
+ * @see https://github.com/carbontwelve/tapestry/issues/86
+ */
+ public function testContentTypeEnabled()
+ {
+ $contentType = new ContentType('Test', []);
+ $this->assertFalse($contentType->isEnabled());
+ $contentType = new ContentType('Test', ['enabled' => true]);
+ $this->assertTrue($contentType->isEnabled());
+ }
+}
diff --git a/tests/EntitiesTest.php b/tests/Unit/EntitiesTest.php
similarity index 98%
rename from tests/EntitiesTest.php
rename to tests/Unit/EntitiesTest.php
index 813e77d..3e1b0f5 100644
--- a/tests/EntitiesTest.php
+++ b/tests/Unit/EntitiesTest.php
@@ -1,11 +1,12 @@
assertNotEmpty($file->getUid());
+ }
+}
diff --git a/tests/FrontmatterTest.php b/tests/Unit/FrontMatterTest.php
similarity index 82%
rename from tests/FrontmatterTest.php
rename to tests/Unit/FrontMatterTest.php
index 27a9f95..7936833 100644
--- a/tests/FrontmatterTest.php
+++ b/tests/Unit/FrontMatterTest.php
@@ -1,20 +1,21 @@
getFileContent());
$this->assertSame('', $frontMatter->getContent());
$this->assertSame([
@@ -26,7 +27,7 @@ function testFrontmatterParsedWhenBodyEmpty()
function testFrontMatterAndBodyParsedCorrectly()
{
- $file = new File(new SplFileInfo(__DIR__ . '/Mocks/TestFile.md', '', ''));
+ $file = new File(new SplFileInfo(__DIR__ . '/../Mocks/TestFile.md', '', ''));
$frontMatter = new FrontMatter($file->getFileContent());
$this->assertSame('This is a test file...', $frontMatter->getContent());
$this->assertSame([
diff --git a/tests/HelpersTest.php b/tests/Unit/HelpersTest.php
similarity index 95%
rename from tests/HelpersTest.php
rename to tests/Unit/HelpersTest.php
index eb9175c..25480e4 100644
--- a/tests/HelpersTest.php
+++ b/tests/Unit/HelpersTest.php
@@ -1,11 +1,12 @@
setupPagination($project, __DIR__ . '/Mocks/TestPaginatorFile.phtml');
+ $generator = $this->setupPagination($project, __DIR__ . '/../Mocks/TestPaginatorFile.phtml');
$generatedFiles = $generator->generate($project);
$this->assertTrue(is_array($generatedFiles));
@@ -75,7 +75,7 @@ public function testPaginationCoreFunctionality()
public function testPaginationSkipFunctionality()
{
$project = new Project('', '', 'test');
- $generator = $this->setupPagination($project, __DIR__ . '/Mocks/TestPaginatorSkipFile.phtml');
+ $generator = $this->setupPagination($project, __DIR__ . '/../Mocks/TestPaginatorSkipFile.phtml');
$generatedFiles = $generator->generate($project);
$this->assertTrue(is_array($generatedFiles));
diff --git a/tests/PlatesExtensionsTest.php b/tests/Unit/PlatesExtensionsTest.php
similarity index 53%
rename from tests/PlatesExtensionsTest.php
rename to tests/Unit/PlatesExtensionsTest.php
index b7b98f4..2092d96 100644
--- a/tests/PlatesExtensionsTest.php
+++ b/tests/Unit/PlatesExtensionsTest.php
@@ -1,36 +1,37 @@
copy(__DIR__ . '/../Mocks/TestEnvironmentFile.phtml', $this->tmpDirectory . '/source/TestEnvironmentFile.phtml');
// Test with default Tapestry testing env set
$viewFile = $this->mockViewFile(
- $this->mockTapestry(__DIR__ . DIRECTORY_SEPARATOR . '_tmp'),
- __DIR__ . '/Mocks/TestEnvironmentFile.phtml', true
+ $this->mockTapestry($this->tmpDirectory),
+ $this->tmpDirectory . '/source/TestEnvironmentFile.phtml', true
);
$this->assertEquals('env: testing', $viewFile->getContent());
// Test with custom env set
$viewFile = $this->mockViewFile(
$this->mockTapestry(
- __DIR__ . DIRECTORY_SEPARATOR . '_tmp',
+ $this->tmpDirectory,
null,
'abc123'
),
- __DIR__ . '/Mocks/TestEnvironmentFile.phtml', true
+ $this->tmpDirectory . '/source/TestEnvironmentFile.phtml', true
);
$this->assertEquals('env: abc123', $viewFile->getContent());
}
diff --git a/tests/RendererTest.php b/tests/Unit/RendererTest.php
similarity index 73%
rename from tests/RendererTest.php
rename to tests/Unit/RendererTest.php
index c62e393..2d1cb70 100644
--- a/tests/RendererTest.php
+++ b/tests/Unit/RendererTest.php
@@ -1,20 +1,21 @@
copyDirectory('/assets/build_test_34/src', '/_tmp');
+ $this->loadToTmp(__DIR__ . '/../assets/build_test_34/src');
- $project = new Project(__DIR__ . '/_tmp', __DIR__ . '/_tmp/build_test', 'test');
+ $project = new Project($this->tmpDirectory, $this->tmpDirectory . '/build_test', 'test');
$renderer = new HTMLRenderer($project);
$this->assertEquals(['htm', 'html'], $renderer->supportedExtensions());
@@ -24,7 +25,7 @@ public function testHTMLRenderer()
$this->assertEquals('html', $renderer->getDestinationExtension('ext'));
$this->assertTrue($renderer->supportsFrontMatter());
- $file = $this->mockFile(__DIR__ . '/_tmp/source/test.html');
+ $file = $this->mockFile($this->tmpDirectory . '/source/test.html');
$this->assertEquals('Hello World', trim($renderer->render($file)));
$renderer->mutateFile($file);
diff --git a/tests/StopwatchProfilerTest.php b/tests/Unit/StopwatchProfilerTest.php
similarity index 94%
rename from tests/StopwatchProfilerTest.php
rename to tests/Unit/StopwatchProfilerTest.php
index c1622f1..209314c 100644
--- a/tests/StopwatchProfilerTest.php
+++ b/tests/Unit/StopwatchProfilerTest.php
@@ -1,10 +1,11 @@
addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-01-a.md'), 'Classification');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-02-b.md'), 'classification');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-03-c.md'), 'CLASSIFICATION');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-04-d.md'), ' CLASSIFICATION');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-05-e.md'), 'ClassificatioN ');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-01-a.md'), realpath(__DIR__ . '/../')), 'Classification');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-02-b.md'), realpath(__DIR__ . '/../')), 'classification');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-03-c.md'), realpath(__DIR__ . '/../')), 'CLASSIFICATION');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-04-d.md'), realpath(__DIR__ . '/../')), ' CLASSIFICATION');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-05-e.md'), realpath(__DIR__ . '/../')), 'ClassificatioN ');
$this->assertEquals(['classification'], array_keys($taxonomy->getFileList()));
}
@@ -83,12 +85,12 @@ public function testTaxonomyClassClassificationCharacters()
{
// Taxonomy should normalise classifications by filtering out spaces
$taxonomy = new Taxonomy('test');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-01-a.md'), 'Classification 123');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-02-b.md'), 'classification-123');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-03-c.md'), 'CLASSIFICATION 123');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-04-d.md'), ' CLASSIFICATION 123');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-05-e.md'), 'ClassificatioN 123 ');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-05-f.md'), ' ClassificatioN 123 ');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-01-a.md'), realpath(__DIR__ . '/../')), 'Classification 123');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-02-b.md'), realpath(__DIR__ . '/../')), 'classification-123');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-03-c.md'), realpath(__DIR__ . '/../')), 'CLASSIFICATION 123');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-04-d.md'), realpath(__DIR__ . '/../')), ' CLASSIFICATION 123');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-05-e.md'), realpath(__DIR__ . '/../')), 'ClassificatioN 123 ');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-05-f.md'), realpath(__DIR__ . '/../')), ' ClassificatioN 123 ');
$this->assertEquals(['classification-123'], array_keys($taxonomy->getFileList()));
}
@@ -140,12 +142,12 @@ public function testTaxonomyClassOrder()
];
$taxonomy = new Taxonomy('test');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-01-a.md'), 'Classification 123');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-02-b.md'), 'classification-123');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-03-c.md'), 'CLASSIFICATION 123');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-04-d.md'), ' CLASSIFICATION 123');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-05-e.md'), 'ClassificatioN 123 ');
- $taxonomy->addFile($this->mockFile(__DIR__ . '/Mocks/TaxonomyMocks/2016-01-05-f.md'), ' ClassificatioN 123 ');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-01-a.md'), realpath(__DIR__ . '/../')), 'Classification 123');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-02-b.md'), realpath(__DIR__ . '/../')), 'classification-123');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-03-c.md'), realpath(__DIR__ . '/../')), 'CLASSIFICATION 123');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-04-d.md'), realpath(__DIR__ . '/../')), ' CLASSIFICATION 123');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-05-e.md'), realpath(__DIR__ . '/../')), 'ClassificatioN 123 ');
+ $taxonomy->addFile($this->mockFile(realpath(__DIR__ . '/../Mocks/TaxonomyMocks/2016-01-05-f.md'), realpath(__DIR__ . '/../')), ' ClassificatioN 123 ');
$this->assertTrue($this->isOr(array_keys($taxonomy->getFileList()['classification-123']), $descArrayA, $descArrayB));
$this->assertTrue($this->isOr(array_keys($taxonomy->getFileList('DESC')['classification-123']), $descArrayA, $descArrayB));