This repository has been archived by the owner on Sep 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathTests.php
54 lines (46 loc) · 1.66 KB
/
Tests.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;
// https://stackoverflow.com/a/42117043/1171790
spl_autoload_register(function ($class_name) {
$CLASSES_DIR = __DIR__.DIRECTORY_SEPARATOR.'classes'.DIRECTORY_SEPARATOR;
$file = $CLASSES_DIR.'class.'.$class_name.'.inc';
if(file_exists($file )) require_once($file);
});
include_once './inc/functions.inc';
final class Tests extends TestCase {
public function testImageCaption(): void {
$this->assertEquals(
'Jacob, Summer 2010',
(new Media)->getPhotoCaption(__DIR__.DIRECTORY_SEPARATOR.'_demo.sections'.DIRECTORY_SEPARATOR.'03_bears/test-bear.jpg')
);
$this->assertFalse(
(new Media)->getPhotoCaption(__DIR__.DIRECTORY_SEPARATOR.'_demo.sections'.DIRECTORY_SEPARATOR.'03_bears/D.jpg')
);
}
public function testDisplay(): void {
$true_section_path = './_demo.sections/03_bears';
$section = 'bears';
$config = Array (
'demo_mode' => true,
'site_title' => 'Photogsite',
'show_site_title' => 1,
'email_address' => 'fake@fake.com',
'show_contact_link' => 1,
'blog_url' => 'http://credittocreation.jonathanbell.ca',
'blog_title' => 'Tumblr',
'show_blog_link' => 1,
'promote_photogsite' => false,
'show_copywrite' => false,
'show_random_homepage_image' => 1,
'use_google_analytics' => 0,
'google_ua_code' => 'UA-26198999-1'
);
$section = new Section($true_section_path, $section, $config);
$section_output = $section->display();
$this->assertIsString($section_output);
$this->assertStringContainsString(
'_demo.sections/03_bears/A.jpg',
$section_output
);
}
}