-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ContainerHelper: Added tests #44
Conversation
$container = $this->prepareConfigurator()->createContainer(); | ||
|
||
/** @var Kdyby\Console\Application $app */ | ||
$app = $container->getByType('Kdyby\Console\Application'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to compile the container and run the app to test that those three new methods work. Unit test would suffice perfectly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if I understand correctly you want me to test just the ContainerHelper with some sort of Container mock? (newbie to testing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't even have to mock the container, just use new Nette\DI\Container()
and pass some arguments and the do asserts on the helper
Alright, is it better now? Shall I add test for |
public function testParameters() | ||
{ | ||
Debugger::$logDirectory = TEMP_DIR . '/log'; | ||
Tester\Helpers::purge(Debugger::$logDirectory); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what are theese two lines for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beats me, I had some weird errors before I rewrote that test, I will try to remove them.
Okay it works now, was probably because I was building container before. |
Cool, thanks 👍 |
ContainerHelper: Added tests
I must say, working with PHPUnit seems so much easier to me.
Anyway here is a draft of a tests, let's see how it goes.