set_include_path('class'); include_once $class_name . '.php'; } writeln("BEGIN TESTING COMPOSITE PATTERN"); writeln(''); $firstBook = new OneBook('Core PHP Programming, Third Edition', 'Atkinson and Suraski'); writeln('(after creating first book) oneBook info: '); writeln($firstBook->getBookInfo(1)); writeln(''); $secondBook = new OneBook('PHP Bible', 'Converse and Park'); writeln('(after creating second book) oneBook info: '); writeln($secondBook->getBookInfo(1)); writeln(''); $thirdBook = new OneBook('Design Patterns', 'Gamma, Helm, Johnson, and Vlissides'); writeln('(after creating third book) oneBook info: '); writeln($thirdBook->getBookInfo(1)); writeln(''); $books = new SeveralBooks(); $booksCount = $books->addBook($firstBook); writeln('(after adding firstBook to books) SeveralBooks info : '); writeln($books->getBookInfo($booksCount)); writeln(''); $booksCount = $books->addBook($secondBook); writeln('(after adding secondBook to books) SeveralBooks info : '); writeln($books->getBookInfo($booksCount)); writeln(''); $booksCount = $books->addBook($thirdBook); writeln('(after adding thirdBook to books) SeveralBooks info : '); writeln($books->getBookInfo($booksCount)); writeln(''); $booksCount = $books->removeBook($firstBook);
echo tagins("head"); echo tagins("/head"); echo tagins("body"); echo "BEGIN TESTING COMPOSITE PATTERN"; echo tagins("br") . tagins("br"); $firstBook = new OneBook("Core PHP Programming, Third Edition", "Atkinson and Suraski"); echo "(after creating first book) oneBook info: " . tagins("br"); echo $firstBook->getBookInfo(1); echo tagins("br") . tagins("br"); $secondBook = new OneBook("PHP Bible", "Converse and Park"); echo "(after creating second book) oneBook info: " . tagins("br"); echo $secondBook->getBookInfo(1); echo tagins("br") . tagins("br"); $thirdBook = new OneBook("Design Patterns", "Gamma, Helm, Johnson, and Vlissides"); echo "(after creating third book) oneBook info: " . tagins("br"); echo $thirdBook->getBookInfo(1); echo tagins("br") . tagins("br"); $books = new SeveralBooks(); $booksCount = $books->addBookk($firstBook); echo "(after adding firstBook to books) SeveralBooks info : " . tagins("br"); echo $books->getBookInfo($booksCount); echo tagins("br") . tagins("br"); $booksCount = $books->addBookk($secondBook); echo "(after adding secondBook to books) SeveralBooks info : " . tagins("br"); echo $books->getBookInfo($booksCount); echo tagins("br") . tagins("br"); $booksCount = $books->addBookk($thirdBook); echo "(after adding thirdBook to books) SeveralBooks info : " . tagins("br"); echo $books->getBookInfo($booksCount); echo tagins("br") . tagins("br"); $booksCount = $books->removeBook($firstBook);