kalecserk
Edit: example
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
class TransferHandler extends BaseHandler {
public function __construct(Generator $faker, DataStorage $storage) {
parent::__construct($faker, $storage);
}
public function handle(ServerRequestInterface $http_request): ResponseInterface {
$resource_token = $http_request->getHeader('X-Resource-Token')[0];
$account_id = $this->storage->account_id_by_resource_token[$resource_token];
if (empty($account_id)) {
return $this->responseInvalidResourceToken($http_request);
}
throw new \Exception('WIP -> store transaction data here for subsequent query, also issue notification');
}
}
With the following test:public function testTransfer() { $juno = JunoAPISimulator::initialize($this->faker); $repo = AccountCreationRepoResolver::resolve();
$account_id = $this->createAccountAndGetId(
$this->merchant,
fn(DigitalAccountRequestOperator $op) => $op->withProvider(DigitalAccountProviderSelector::JUNO())
);
try {
Executor::execute(new IssueTransferByBankDetails(
$account_id->toHex(),
"BRL 12.42",
$_ispb = '21018182',
$_agencyNumber = '0001',
$_accountNumber = '10000368021',
$_accountType = 'CHECKING',
));
$this->fail('should have thrown exception');
} catch (\Throwable $e) {
$this->assertEquals('WIP -> store transaction data here for subsequent query, also issue notification', $e->getPrevious()->getMessage());
}
}What you have instead is knowledge debt as engineers turn over, and the once intuitive and elegant parts of the codebase are utterly alien to the new hires who learned their craft in a totally different way. This isn’t tech debt because engineers can’t intuitively anticipate the business’s future.
That is it! Thank you for sharing your thoughts.
Almost impossible to prove anything in a sufficiently complex system such as SQLite. The difference between assert and always seems arbitrary IMHO
I am currently 36, working for pay as a software developer since 1999, father of three -- and I would like to reiterate oppositelock's comment: "you're being too picky"
I totally understand your frustration with all this "helping other people" buzz but... Ultimately this is the job to be done by you right now :)
About the entire open-office culture, since I am a manager I have been granted a private office - which I have immediately converted into a shared quiet space to work for whoever might need it. I actually prefer to be where things get done.
I really think the problem lies in the engineering culture and maturity of the teams you had the chance to work with. Keep on looking!
Best,
Even for manual tests, the test spec should make part of the change request and be reviewed appropriately.
Cheers!
I was discussing this with a coleague this week: starting by the lower level details vs starting from the more abstract/whole api. I prefer to start by writing a final API candidate and its integration tests and only write/derive specific lower level components/unit tests as they become required to advance on the integration test. My criticism on starting with the bottom-up is that you may end up leaking implementation details in your tests and API because you already defined how the low level components work. I have even seen cases where the developer end up making the public API more complex than necessary due to the nature of the low level components he has written. Food for thought!