Skip to content

Commit

Permalink
Used autoload dev for testing environment
Browse files Browse the repository at this point in the history
  • Loading branch information
stekycz committed Feb 7, 2016
1 parent b3b042d commit 4a73792
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@
},
"autoload": {
"classmap": ["Cronner/"]
},
"autoload-dev": {
"classmap": ["tests/CronnerTests/objects"]
}
}
26 changes: 24 additions & 2 deletions tests/CronnerTests/Cronner.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ use Nette\Utils\DateTime;
use stdClass;
use stekycz\Cronner\Cronner;
use stekycz\Cronner\Tasks\Task;
use stekycz\Cronner\tests\objects\AnotherSimpleTestObject;
use stekycz\Cronner\tests\objects\NextSimpleTestObject;
use stekycz\Cronner\tests\objects\SameTaskNameObject;
use stekycz\Cronner\tests\objects\TestExceptionObject;
use stekycz\Cronner\tests\objects\TestObject;
use Tester\Assert;



require_once(__DIR__ . "/bootstrap.php");
require_once(__DIR__ . "/objects/TestObject.php");
require_once(__DIR__ . "/objects/TestExceptionObject.php");

/**
* @author Martin Štekl <[email protected]>
Expand Down Expand Up @@ -222,6 +223,27 @@ class CronnerTest extends \TestCase
$this->cronner->run($now);
}



public function testAddingTwoTestsWithTheSameNameInOneObject()
{
$self = $this;
Assert::exception(function () use ($self) {
$self->cronner->addTasks(new SameTaskNameObject());
}, '\stekycz\Cronner\DuplicateTaskNameException');
}



public function testAddingTwoTestsWithTheSameNameInMoreObjects()
{
$self = $this;
Assert::exception(function () use ($self) {
$self->cronner->addTasks(new AnotherSimpleTestObject());
$self->cronner->addTasks(new NextSimpleTestObject());
}, '\stekycz\Cronner\DuplicateTaskNameException');
}

}

run(new CronnerTest());
1 change: 0 additions & 1 deletion tests/CronnerTests/Tasks/ParametersParsing.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use Tester\Assert;


require_once(__DIR__ . "/../bootstrap.php");
require_once(__DIR__ . "/../objects/TestObject.php");

/**
* @author Martin Štekl <[email protected]>
Expand Down
1 change: 0 additions & 1 deletion tests/CronnerTests/Tasks/Task.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use Tester\Assert;


require_once(__DIR__ . "/../bootstrap.php");
require_once(__DIR__ . "/../objects/TestObject.php");

/**
* @author Martin Štekl <[email protected]>
Expand Down

0 comments on commit 4a73792

Please sign in to comment.