mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 09:51:21 -06:00
Some tests.
This commit is contained in:
parent
68cdfd00b0
commit
e6db49c20c
@ -73,6 +73,10 @@ class Range
|
||||
Session::put('first', Carbon::now()->startOfYear());
|
||||
}
|
||||
}
|
||||
|
||||
// check "sum of everything".
|
||||
|
||||
|
||||
$current = Carbon::now()->formatLocalized('%B %Y');
|
||||
$next = Carbon::now()->endOfMonth()->addDay()->formatLocalized('%B %Y');
|
||||
$prev = Carbon::now()->startOfMonth()->subDay()->formatLocalized('%B %Y');
|
||||
|
46
cover.sh
Executable file
46
cover.sh
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# set testing environment
|
||||
cp .env.testing .env
|
||||
|
||||
# set cover:
|
||||
cp phpunit.cover.xml phpunit.xml
|
||||
|
||||
# test!
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
phpdbg -qrr /usr/local/bin/phpunit
|
||||
fi
|
||||
|
||||
# directories to look in:
|
||||
#dirs=("controllers" "database" "factories" "generators" "helpers" "models" "middleware" "repositories" "support")
|
||||
#
|
||||
#if [ ! -z "$1" ]
|
||||
#then
|
||||
# for i in "${dirs[@]}"
|
||||
# do
|
||||
# firstFile="./tests/$i/$1.php"
|
||||
# secondFile="./tests/$i/$1Test.php"
|
||||
# if [ -f "$firstFile" ]
|
||||
# then
|
||||
# # run it!
|
||||
# phpunit --verbose $firstFile
|
||||
# exit $?
|
||||
# fi
|
||||
# if [ -f "$secondFile" ]
|
||||
# then
|
||||
# # run it!
|
||||
# phpunit --verbose $secondFile
|
||||
# exit $?
|
||||
# fi
|
||||
#
|
||||
#
|
||||
# done
|
||||
#
|
||||
#fi
|
||||
|
||||
# restore .env file
|
||||
cp .env.local .env
|
||||
|
||||
# restore cover
|
||||
cp phpunit.default.xml phpunit.xml
|
41
phpunit.cover.xml
Executable file
41
phpunit.cover.xml
Executable file
@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ phpunit.cover.xml
|
||||
~ Copyright (C) 2016 Sander Dorigo
|
||||
~
|
||||
~ This software may be modified and distributed under the terms
|
||||
~ of the MIT license. See the LICENSE file for details.
|
||||
-->
|
||||
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="bootstrap/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false">
|
||||
<testsuites>
|
||||
<testsuite name="Application Test Suite">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">app/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<!--
|
||||
Code coverage has never been slower.
|
||||
-->
|
||||
<logging>
|
||||
<log type="coverage-clover" target="./storage/build/clover.xml" charset="UTF-8" />
|
||||
</logging>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="QUEUE_DRIVER" value="sync"/>
|
||||
</php>
|
||||
</phpunit>
|
35
phpunit.default.xml
Executable file
35
phpunit.default.xml
Executable file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="bootstrap/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false">
|
||||
<testsuites>
|
||||
<testsuite name="Application Test Suite">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">app/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
<!--
|
||||
Code coverage has never been slower.
|
||||
-->
|
||||
<!--
|
||||
<logging>
|
||||
<log type="coverage-clover" target="./storage/build/clover.xml" charset="UTF-8" />
|
||||
</logging>
|
||||
-->
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="QUEUE_DRIVER" value="sync"/>
|
||||
</php>
|
||||
</phpunit>
|
@ -17,6 +17,7 @@ class HomeControllerTest extends TestCase
|
||||
$args = [
|
||||
'start' => '2012-01-01',
|
||||
'end' => '2012-04-01',
|
||||
'_token' => Session::token(),
|
||||
];
|
||||
|
||||
// if date range is > 50, should have flash.
|
||||
@ -25,4 +26,19 @@ class HomeControllerTest extends TestCase
|
||||
$this->assertSessionHas('warning', '91 days of data may take a while to load.');
|
||||
}
|
||||
|
||||
public function testFlush()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$response = $this->call('GET', '/flush');
|
||||
$this->assertEquals(302, $response->status());
|
||||
}
|
||||
|
||||
public function testIndex()
|
||||
{
|
||||
$this->be($this->user());
|
||||
$response = $this->call('GET', '/');
|
||||
$this->assertEquals(200, $response->status());
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user