- Add HVAC_Test_User_Factory class with: * User creation with specific roles * Multiple role support * Persona management system * Account cleanup integration - Create comprehensive test suite in HVAC_Test_User_Factory_Test.php - Update testing improvement plan documentation - Add implementation decisions to project memory bank - Restructure .gitignore with: * Whitelist approach for better file management * Explicit backup exclusions * Specific bin directory inclusions Part of the Account Management component from the testing framework improvement plan.
41 lines
No EOL
1.4 KiB
PHP
41 lines
No EOL
1.4 KiB
PHP
<?php
|
|
/**
|
|
* Tests for HVAC_Test_Data_Generator
|
|
*/
|
|
|
|
require_once __DIR__ . '/HVAC_Test_Data_Generator.php';
|
|
|
|
class HVAC_Test_Data_Generator_Test extends WP_UnitTestCase {
|
|
public function test_generate_event_data() {
|
|
$event = HVAC_Test_Data_Generator::generate_event_data();
|
|
|
|
$this->assertArrayHasKey('title', $event);
|
|
$this->assertStringStartsWith('Test Event', $event['title']);
|
|
$this->assertArrayHasKey('start_date', $event);
|
|
$this->assertNotEmpty($event['start_date']);
|
|
}
|
|
|
|
public function test_generate_user_data() {
|
|
$user = HVAC_Test_Data_Generator::generate_user_data();
|
|
|
|
$this->assertArrayHasKey('user_login', $user);
|
|
$this->assertStringStartsWith('testuser_', $user['user_login']);
|
|
$this->assertEquals('hvac_trainer', $user['role']);
|
|
}
|
|
|
|
public function test_generate_multiple_events() {
|
|
$events = HVAC_Test_Data_Generator::generate_multiple_events(3);
|
|
|
|
$this->assertCount(3, $events);
|
|
$this->assertNotEquals($events[0]['title'], $events[1]['title']);
|
|
}
|
|
|
|
public function test_data_overrides() {
|
|
$custom_title = 'Custom Event Title';
|
|
$event = HVAC_Test_Data_Generator::generate_event_data([
|
|
'title' => $custom_title
|
|
]);
|
|
|
|
$this->assertEquals($custom_title, $event['title']);
|
|
}
|
|
} |