FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
DesignPatternsPHP/Structural/Adapter/Tests/AdapterTest.php at master · JavaDevl/DesignPatternsPHP · GitHub
JavaDevl
/
DesignPatternsPHP
Public
forked from
DesignPatternsPHP/DesignPatternsPHP
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
DesignPatternsPHP
/
Structural
/
Adapter
/
Tests
/
AdapterTest.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (37 loc) · 1.13 KB
Breadcrumbs
DesignPatternsPHP
/
Structural
/
Adapter
/
Tests
/
AdapterTest.php
Copy path
File metadata and controls
41 lines (37 loc) · 1.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
namespace
DesignPatterns
\
Structural
\
Adapter
\
Tests
;
use
DesignPatterns
\
Structural
\
Adapter
\
Book
;
use
DesignPatterns
\
Structural
\
Adapter
\
EBookAdapter
;
use
DesignPatterns
\
Structural
\
Adapter
\
Kindle
;
use
DesignPatterns
\
Structural
\
Adapter
\
PaperBookInterface
;
/**
* AdapterTest shows the use of an adapted e-book that behave like a book
* You don't have to change the code of your client.
*/
class
AdapterTest
extends
\PHPUnit_Framework_TestCase
{
/**
* @return array
*/
public
function
getBook
()
{
return
array
(
array
(
new
Book
()),
// we build a "wrapped" electronic book in the adapter
array
(
new
EBookAdapter
(
new
Kindle
())),
);
}
/**
* This client only knows paper book but surprise, surprise, the second book
* is in fact an electronic book, but both work the same way.
*
* @param PaperBookInterface $book
*
* @dataProvider getBook
*/
public
function
testIAmAnOldClient
(
PaperBookInterface
$
book
)
{
$
this
->
assertTrue
(
method_exists
(
$
book
,
'
open
'
));
$
this
->
assertTrue
(
method_exists
(
$
book
,
'
turnPage
'
));
}
}
Back
|
FazBrowse Home
|
New Git URL