I have a test in which I have to access the modifications made in the function I want to test:
BEGIN;
SELECT '';
SELECT plan(1);
CREATE FUNCTION insert_email(_email text) RETURNS uuid AS $$
INSERT INTO email (name, email_verification_token) VALUES (_email, gen_random_uuid) RETURNING email_verification_token;
$$ language sql;
SELECT is(insert_email('test@test.com'), (SELECT email_verification_token FROM email WHERE name = 'test@test.com'), 'Verification token is created');
SELECT * FROM finish();
ROLLBACK;
But if I test like this, the subquery for the assertion returns NULL. After the test, the record is created. I was wondering if there is any possibility of having access to the values created by the test in the assertion?
I have a test in which I have to access the modifications made in the function I want to test:
But if I test like this, the subquery for the assertion returns NULL. After the test, the record is created. I was wondering if there is any possibility of having access to the values created by the test in the assertion?