-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add unit tests for JInstallerAdapter #7569
Conversation
$mockDatabase = $this->getMockDatabase(); | ||
$object = $this->getMockForAbstractClass('JInstallerAdapter', array($mockInstaller, $mockDatabase, array('foo' => 'bar'))); | ||
|
||
$this->assertInstanceOf( |
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.
$this->assertAttributeInstanceOf('JTableExtension', 'extension', $object);
Don't need to use our Reflection helpers here. Use the PHPUnit API as it's practical.
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.
Fixed and a couple of other instances based on this
* @subpackage Installer | ||
* @since 3.4.4 | ||
*/ | ||
class JInstallerAdapterTest extends TestCaseDatabase |
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.
If you've mocked everything and you aren't running any real database queries (still looking this over), then you can just extend TestCase
instead. Saves a few processing cycles on the test setup if it doesn't have to deal with the database configuration.
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.
OK So my dataset still isn't being loaded :(
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.
Stop overriding JFactory::$database
in your setup method. TestCaseDatabase
is setting the test connection in its setup routine.
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.
Ahh fair. Does this mean I don't need to inject the extensions data set as well?
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.
Long and short, just make sure all the changes from wilsonge@6ab866e are reverted and we can go from there.
Can you put |
Done everything I think |
Well, the question was answered on the database thing. Guess it needs to extend TestCaseDatabase. |
I'm going to try mocking the |
@mbabker where we at with this? |
Add unit tests for JInstallerAdapter
This gives us code coverage of ~75% of the lines in the class (15/23 methods in the class)