Skip to content

Instantly share code, notes, and snippets.

@jakeasmith
Last active August 29, 2015 14:03
Show Gist options
  • Save jakeasmith/51e6c464957f2f8d5a67 to your computer and use it in GitHub Desktop.
Save jakeasmith/51e6c464957f2f8d5a67 to your computer and use it in GitHub Desktop.
<?php
abstract class BaseType
{
abstract public function calculate($foo, $bar);
public function validate($baz)
{
return $baz === true;
}
}
<?php
class SpecialType extends BaseType
{
public function calculate($foo, $bar) {
// ...
}
}
@jakeasmith
Copy link
Author

What’s the general recommendation on testing methods in an abstract class?

Option 1: Extend BaseType just for testing. Seems weird.
Option 2: Test BaseType as part of the SpecialType test case. Seems fragile.
Option 3: Erm. Something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment